Introduction Forms are used on web pages to gather information from the pages’ visitors. They are especially useful for surveys and comment forms. Each form must have a small program, or script to process the information and do something with it. In this guide we will show you how to insert a form using Marshall’s mailto script into your web page. Please note that this script will only work for pages affiliated with Marshall University.
Using the MAILTO Script Marshall’s mailto script will take the name of each field in the form and pair it with its value (what the visitor entered) when submitted. Each of these name/value pairs will be put in an e-mail and sent to an address you specify.
The following steps will guide you through creating your own form using the mailto script using FrontPage 2003. First you will create a form and set its properties so it uses Marshall’s script. Then you will add hidden fields to customize the script for your use and add visible fields to gather information.
To insert a form in your web page:
1. Place the cursor where you want the form to be created.
2. To create the form, select Form from the Form submenu in the Insert menu (Insert -> Form -> Form).
3. Click within the dotted box representing the form with the right mouse button.
4. Select Form Properties….
5. In the Form Properties window, select Send to other and Custom ISAPI, NSAPI, CGI, or ASP Script.
6. Click on the Options… button in the Form Properties window.
7. Enter http://www.marshall.edu/cgi-bin/formmail.asp as the Action and make sure that POST is selected as the Method.
8. Click on the OK button in the Options window.
9. Click on the Advanced… button in the Form Properties window. Here you will add hidden fields to the form to customize the script for your particular use.
10. In the Advanced window, click on the Add… button.
11. In the Name/Value Pair window, enter one of the special field names listed in the table below and the value to customize the script for your use. The MAILTO_ADDRESS field is required, and all others are optional.
|MAILTO_ADDRESS (Required)||The e-mail will be sent to the address(es) in the value of this field. If you need to have the form submitted to multiple recipients, consider setting up an email alias to facilitate this.|
|MAILTO_SUBJECT||The subject of the e-mail will be set to the value of this field. A blank subject is used if this field is not specified.|
|MAILTO_TITLE||The title on the page after the user submits the form will be set to the value of this field. The text 'Form Submission Status' is used if this field is not specified.|
|MAILTO_SUCCESS||The message displayed upon successful will be set to the value of this field. The text “Submission completed successfully” is used if this field is not specified.|
|MAILTO_URL||The URL to be used in a link at the bottom of the page will be set to the value of this field. A link will not be displayed if this field is not specified.|
|MAILTO_URLTEXT||The text to be associated with the link will be set to the value of this field. The text “Continue” is used if a URL was specified and this field is not specified.|
|MAILTO_REDIRECT||Upon successful submission, the browser will be sent to the URL in the value of this field. The other fields listed on this page are ignored if the MAILTO_REDIRECT field is used.|
12. Click on the OK button in the Advanced window.
13. Proceed to add fields to your form using the Insert menu. (See the FrontPage 2003 Guide for more information on how to do this.) The name of each field will be listed in the e-mails followed by the field’s value.
Conclusion Congratulations, you have added a submission form to your web page. The form will not work when previewing the page on your computer; however, it will appear once you send the page to the server and view it through a web browser.
In each e-mail you get from a submission you will notice some information in the e-mail besides from your form. The IP address along with some other technical information is included to identify where the submission came from. This information can be important if you need to track down abusive submissions.
This mailto script is a good way to gather information from your visitors. You will probably want to create a few sample forms using the different form fields such as text fields and check boxes to get a feel for how the e-mail message you receive is going to look. As with anything related to web development, be sure to test your form pages thoroughly before putting them into production.