header left image   header right image

Home > Toolkit > eform.cgi > Create 2 Files

Form Processing (Create 2 Files)

Make sure at this point, you've set your action attribute and added the necessary two hidden elements to your form. If you have not, here's how.

Before the form is ready to be published, two more files need to be created, email.txt and output.html.

The purpose of email.txt is to serve as the template for the email sent when the user submits the form.

The purpose of output.html is to be what the user sees after submitting the form. Typically, this is a "thank you" screen.

Email.txt
This is the email template the script will use to send the user's results. It is important that all your form elements were named. These names are how eform pulls the information from the form.
In this file, put your form element name inside square brackets [ ], and the script will replace it with the user response. A form element can be a textfield, radio button, checkbox or any other of these items.

Open a simple text editor (SimpleText or Notepad) and name it "email.txt". The first line in this file will be where the user results are sent. The "To:" is required.
Example:
To: Webpublishing@brown.edu

Next, put in where the email is coming from. If your form gets the user's email address, use that here. Remember, to use information from the form, put the element's name in square brackets.
Example:
From: [email]
The script will look through your form for an element named "email" and replace with what the user entered.

If you want a subject to the email, you can do that next. The value can be something you just type in or also taken from a form element.
Example:
Subject: Form Results

Then, simply skip a line, and type in the body of the email, using form element names in square brackets where you want the user input to appear.
Example:
Hi, my name is [name] and I would like more information on [subject]. Could you please send that to [email] or contact me at extension [phone].
[name], [subject],[email] and [phone] would have needed to be the names of elements in your form. Complete example:

To: Webpublishing@brown.edu
From: [email]
Subject: Form Results

Hi, my name is [name] and I would like more information on [subject]. Could you please send that to [email] or contact me at extension [phone].


Save this file (as email.txt) and upload it to the same directory that your form page is in.

Output.html
This will be the page the user sees after submitting the form. This file is just a typical web page, nothing more special about it. If you do want to get a little bit fancy, you can use the form elements in this page the same way you did in the email.txt file. For example, if you wanted to thank your user by name, and the form has a name field, you could add this line in the output.html page:
Thank you [name], we will get back to you on that request for [subject].

Once this page is completed, save it as output.html and upload it to the same directory as your form page and email.txt file. Now go test it out!

At this point, you have created a fully functional form. If you'd like to see some additional tricks you can add to your form processing, go to Part 3.


If you still have any questions about Brown's form processing, send your questions to Webpublishing@brown.edu.


Script courtesy of Jon's CGI-Scape
Available at: http://www.cgi.tj/scripts/alienform


[Toolkit]   [ Publishing Help]   [Publisher Forum]   [Web Policies]  [Web Security]   [Brown Home]   [CIS Home]   [Home]


Page Last Modified: Tuesday, 23-Mar-2004 15:46:54 EST by CIS