Aug 31, 2000, 7:27 PM
Post #1 of 4
Help with form output to html file
I have just started learning the basic of cgi programing using perl. I am using a form from a book and i am trying to make it work for my idea. This is an excersise i have decide to make. Originaly the form was made just to show how can one form be build on html and originaly on the book it have no script to use with it. So i decide to make the script and try to apply what i believe i have learn. Looks like i quite haven't get the idea since it is not working. What i need is somebody to point out my mistakes. I will post here both the form and the perl script. I just hope i don't crash the server... BTW i am running this on an Apache server on a RedHat 6.2 Linux server. I have run several other scripts already ranging from a very simple voting form to a guestbook and a shtml counter. So the server should be setup ok and not be the problem. Also all the files have executable permision and can be read by everyone...
Here is the form,i will omit the html and body from the beggining and the bottom just to try to avoid the form to be readed and post it as an html page... Before i forget, this is a server on an intranet, i have no dns name...
<head><title>A Survey Form</title></head>
<h1>A Survey Form</h1>
<form action="http://linux.quinonesfamily.com/cgi-bin/survey.pl" METHOD="post">
<INPUT TYPE="text" NAME="name" SIZE=30 MAXSIZE=50>
<INPUT TYPE="checkbox" NAME="purchaser" VALUE="yes">
I am authorized to make purchases.
<INPUT TYPE="radio" NAME="budget" VALUE="1000">Less than $10,000<br>
<INPUT TYPE="radio" NAME="budget" VALUE="100000">From $10,000 to $100,000<br>
<INPUT TYPE="radio" NAME="budget" VALUE="1000000">From $100,000 to$1,000,000<br>
Current job reponsibility:
<SELECT NAME="job" SIZE=1>
<OPTION VALUE="senior">Senior Management
<TEXTAREA NAME="comments" WRAP="virtual" COLS=40 ROWS=6></textarea>
This is the pearl file i am trying to make work. I just want it to generate a simple html output showing the choices made on the survey.html. All i am getting righ know is the text on the html but the choices wont show. I have omited the shebang for just in case..
#Impirt the cgi module and create a quieyt object to retrieve the
$query = new CGI;
print "<html><head><title>Survey Info</title></head><body>\n";
print "<h1>Survey Info</h1>\n";
print "<p>You are $name</p>\n";
print "<p>You answer $purchaser to the question if you can purchase.</p>\n";
print "<p>Your budget is around $budget</p>\n";
print "<p>The position you have in the company is $job</p>\n";
print "<p>This are your coments:</p>\n";
I will realy apreciate any help that can be provided. You don't need to tell me how to do it, although i wouldn't mind. But if you just point out the mistake i am doing i will try to find out the correct way looking over the documentation i have.
[This message has been edited by Nandy (edited 08-31-2000).]