Feedback CGI
Feedback.cgi is a script which takes information submitted by a person who fills out an HTML form
and emails that information to an address that you specify. As the web developer, you control the elements on the HTML form and the format of the e-mail message.
You also prepare a response that is displayed to user after they submit the form. You can require responses to any of these
elements before you allow the user to submit the form.
The feedback.cgi script is available in the /cgi-bin directory of all web sites hosted by the WEG. For security reasons, the directory does not appear in your directory on webpub.ucar.edu. However, if you point your form action to /cgi-bin/feedback.cgi you will see that it works.
To get started, you may want to copy and modify the templates below.
An overview of the HTML form tags you will use
when you create forms is also available.
You may copy and modify templates for various kinds of forms to help you create your own forms.
- View the set of three form examples and save as source the example that most closely resembles the form you want to create.
- Use an HTML or text editor to
modify the HTML, email and response template on your local workstation.
Be sure to change the email address in the email.txt file to your own address. For more detailed instructions, see "Procedure for modifying templates" below.
- Upload your modified templates
to your web site.
- Test your form by using your browser to fill it out it in different
ways and submit it each time. Check the e-mail messages sent by the
form to make sure that all of the information you need is getting
through. If your form has required elements, submit the form without one
of the required elements to verify that the error response is working.
Here in greater detail are the steps to modify each of the three templates to create your own
form.
- Modify the "main" template. This is an HTML file.
- Rename the file to indicate its purpose.
- Establish the title for the form.
- Provide a heading on the page to indicate the purpose of the form.
- Describe the purpose of the form with text. Note the reasons for any
required elements.
- Begin the form with the <FORM> tag.
- Set the basic inputs to the feedback.cgi script.
- Set any required inputs to the feedback.cgi script.
- Request input from the user via:
- Single-line text boxes
<INPUT> tag, TYPE=TEXT is the default
- Multi-line text boxes
<TEXTAREA> </TEXTAREA> tag pairs
- Radio buttons (only one of the group can be selected)
- Check boxes (one or more of the group can be selected)
<INPUT TYPE="CHECKBOX"> tag
- Lists of pre-defined choices
<SELECT> and <OPTION> tags
- Place the SUBMIT and RESET buttons at the end of the form.
- End the form with the </FORM> tag.
- Modify the "resp" template. This is an HTML file.
- Rename the file to indicate its purpose; be sure that the filename
matches the name given by the "_return_doc" tag in the main file.
- Establish the title.
- Provide a heading for the page to indicate the purpose of this
response message: it replaces the form after the user presses
the SUBMIT button.
- Describe the action that the form takes after it is submitted.
- Provide a link from this response message to another page that
would be useful to the user. This link usually returns users to
the place where they accessed your form. Note that this link will be made from the server's cgi-bin directory, so you
should use the complete URL for this link.
- Modify the "email" template. Note that this is a TEXT file.
- Rename the file to indicate its purpose; be sure that the filename
matches the name given by the "_email_doc" tag in the main file.
- Provide "From:", "To:", and "Subject:" lines as the first three
lines of the text file to ensure that the e-mail software formats and
sends the message properly.
- Place the appropriate input variable on the "From:" line. If this
is not an e-mail address that you requested from the user, then an
uninformative default value will be supplied.
Note: You defined all of your input variables in the "main"
file of your form. Some of these input variables are in the
<INPUT TYPE="hidden" ... > lines at the beginning of your
form, and some are in the body of your form as <INPUT>,
<TEXTAREA>, and <SELECT> tags. In the "email.txt"
file, all input variable names must be preceded by a dollar sign
and enclosed in braces. Example: ${name}
- Place the appropriate e-mail address on the "To:" line. This
may be a valid e-mail address or an input variable from the form
that resolves to a valid e-mail address.
- Place some informative text, which may include input variables,
on the "Subject:" line.
- Arrange the text of the e-mail message so the result of the
submitted form will be readable by the person who receives it.
The e-mail message will be formatted exactly like the plain-ASCII
text of your "email.txt" file. All of the input that you requested
from the user should be included in the "email.txt" file.
Test and retest your form before you publish it! |
|
 |
Web Engineering Group |
|
|