The content of this document may be incorrect or outdated.
Print this article Edit this article
Processing form data
Your CGI Interface
First you should become familiar with running CGI (common gateway interface) programs. For information on how to run CGI programs within ECN, read the How to Run CGI Programs Answer.You will need to become familiar with cgi scripts because you will need a gateway program or script to process the input from your form.
Overview of Steps
- In your ~/public-web/ directory. Create/edit your .htaccess file to execute cgi and define a file extension that will tell web server to run the file as a cgi. For example:
Options ExecCGI
AddType application/x-httpd-cgi .cgi - Create a cgi script.
- In your html document, reference your cgi script.
The Form
This document will be a file in which you will insert HTML form tags to create your form.To reference your CGI file, you must have a line like this in your form document:
<form method ="POST" action="userform.cgi">"userform.cgi" is the name of the script or program you created in step #2 above.
Your file userform.cgi is the program which handles the input of your form. Or it can be a shell script which contains a reference to another program which handles the input of your form. You can see this as in example in the How to create a form using ECN email-form
Conclusion
You must have the following in your ~/public-web/ directory or a subdirectory of your ~/public-web/ directory:
- A .htaccess file. This file must be world readable:
% chmod 744 .htaccess or
% chmod o+r .htaccess - A CGI program which will handle the input of your form. This program must be in mode 755:
% chmod 755 file.cgi or
This filename extension must be the same as the file extension defined in your .htaccess file. The file could be named file.cgi.
% chmod o+xr file.cgi - The form itself, which is an HTML document. This file must be mode 755:
% chmod 755 file.html or
% chmod 0+rx file.html
To View and Test Your Form
After you have followed the above steps and created a form, you can now view it and test it. To view the form file, which will be in your ~/public-web/ go to the URL:http://host.ecn.purdue.edu/~login/form.htmlYou do not need to put "public-web" in the URL. To test your form, just fill in the fields and send/submit it.
Additional Information
How to Run CGI Programs
How to Create a Form Using ECN email-form
Carlos' Forms Tutorial
Last Modified:
Dec 19, 2016 11:12 am US/Eastern
Created:
Mar 21, 2007 12:02 pm GMT-4
by
admin
JumpURL: