[an error occurred while processing this directive]
This page is very simple. Create a basic form in HTML for the user to enter information. In the <FORM> tag at the top of the form we will add 2 paramerters, ACTION="path/to/myscript.cgi" and METHOD="post".
Let's say I am going to save this file in the same perltour folder, so that the pathnames are easy. I plan to call the CGI which it will use "test2.cgi".
I create a page that looks like this. Feel free to copy and paste
this page to your favorite HTML text-based editor.
Name this page testform.htm , and use your FTP program to upload
it to the perltour folder.
<FORM ACTION="test2.cgi" METHOD="POST">
First Name <INPUT NAME="first" TYPE=TEXT SIZE=25><BR>
Last Name <INPUT NAME="last" TYPE=TEXT SIZE=25><BR>
E-mail <INPUT NAME="email" TYPE=TEXT SIZE=30><BR>
<INPUT TYPE=SUBMIT VALUE="Test it">
</FORM>
</BODY></HTML>
When the user clicks the submit button at the bottom of the form, the server will execute the program called "test2.cgi" and pass all of the information the user entered to the program. Method can be either POST or GET. When the method=GET the values appear in the location box next to the URL. You may have seen this when using Search Engines such as Yahoo! The Post method is more secure, and better with large amounts of information. In general, you should always use POST for now.
IMPORTANT: If your server uses a cgi-bin, then the
forms on your HTML pages must have the script
name preceeded with /cgi-bin/. For example, instead of opening a
form with
<FORM ACTION="test2.cgi" METHOD="POST">
I would now write
<FORM ACTION="/cgi-bin/test2.cgi" METHOD="POST">
Use this form in a CGI |