![]() |
Using CGI Script to process the form dataCreating a form using Dreamweaver is easy. But when a user enters the information and clicks the 'submit' button, what happens to the information? It is being sent back to the server but shouldn't the server know how to handle that information? We have to provide instructions to the server on what we want it to do with the information. The most commonly used program to provide form processing instructions to the server is written in a format known as CGI (Common Gateway Interface). It is something that computer programmers learn. For the rest of us humans at WMU, there is an easier solution. Office of Information Technology has developed an appropriate CGI script to process form data on WMU servers and it is called gform. There are two main ways data can be handled using gform.
The easiest of the two is the first. So let us go through the steps enter the server instructions to process the form data. Step 1: In the action box of the form, enter /cgi-bin/gform. Step 2: After creating the form in Dreamweaver, go to the HTML version of the document. Locate the <form> and </form> tags and all that goes in between. Place the cursor after the </form> tag and enter gform instructions. The instructions will depend upon the number of variables in your form. For each variable you require to enter one line of instruction. Finally, a command to deliver the information to a designated email address. See a simple example below: <form name="My form" method="post" action="/cgi-bin/gform"> <!--gform "Form submitted by: $(name)\n"--> // this line for 'name' variable. <!--gform "The date is $(date) and the time is $(time)\n"--> <!--gform "Email address: $(email)\n"--> // this line for 'email' variable <!--gform deliver=mail "kayany@wmich.edu" subject="Email newsletter"--> This last line instructs the server to email the information to me.
If you want to learn more features of gform, check out the page on gform on WMU's server. Warning: GFORM is not a userfriendly programHonestly, gform is not a very userfriendly program. A couple of lessons that I was taught while struggling with the program are the following:
|
|
©
Joseph Kayany, School of Communication, Western Michigan University
Kalamazoo, Michigan, USA. November 17, 2006 |