Using Email Forms

Included with all web hosting is the ability to create a form on your web pages that you can have visitors email you with. Form creation can be rather complex. Be sure you read all of the information below when creating your HTML pages to use the Avvanta form mail program as common errors are outlined below, as well as how to avoid them.

To create your form, you will need to insert various form elements in your HTML pages. The guide below details all of the available options and setup of the form.

Form Elements and Required Tags

  1. Start Form Processing (Required)
    <form method="post" action="/cgi-bin/form-mail.cgi">

    To start your form, insert this as the first line of the form. This will not show up on the web page, it just tells the web browser where to look for the CGI.

  2. Set the Recipient of the Email (Required)
    <input type="hidden" name="Recipient" value="username">

    This is where you define where this form will send the data it collects. This form will only send mail to Avvanta addresses, and does not need anything more than your login ID (it doesn't want the @avvanta.com part of your email address).

  3. Set the Message Subject for the Email (Optional)
    <input type="hidden" name="Subject" value="WWW Comments">

    Whatever you put as the value will be the Subject for the email you receive from this form.

  4. Define the Labels (Required)
    <input type="hidden" name="TextLabel1" value="URL: ">

    This is where you define what the form is going to send you. Without defining these Labels you will receive an empty form. You can define up to 21 different Labels. Each different piece of information you ask for in your form must have it's own Label. The order that you define these Labels in will appear in that order in the email.

  5. Define the Fields (Required)
    <textarea name="TextField1" rows="5" cols="80"></textarea> or
    <input type="text" name="TextField1" size="45">

    The Labels and Fields work together. The Labels define the layout of the data, while the Fields define the data itself. Neither the Labels nor the Fields will work without the other.

    The difference between the two examples above is that the textarea will create a multi-line box that is generally used for a comment area. The other example will create a small, single line, box. If you want the text to wrap in the textarea use this:
    <textarea name="TextField1" rows="5" cols="80" wrap></textarea>

  6. Add the Submit Button (Required)
    <input type="submit" value="Send Mail">

    The submit button will send the information via email to you once it is pressed by your visitor. You can put whatever you want as the value (value="whatever you want in here").

  7. Add a Clear Button (Optional)
    <input type="reset" value="Erase Mail">

    The clear button will reset the form. You can put whatever you want as the value (value="whatever you want in here").

  8. Close the Form (Required)
    </form>

    As with many HTML tags, it is important to let the web browser know where the form starts and stops.

  9. Test Your Form (Highly Recommended)

    It is highly recommended that you test your form before you make it official.

If you are left wondering what all this really means, please see the example form code below, complete with its source HTML code.

Multiple choice questions? No problem. The form mail script can be used to make pull-down menus, checkboxes radio buttons, and define what page you would like to return the user to after they finish the form. See below for more samples.

Example Form

This form is fully functional.

<form method=post action="/cgi-bin/form-mail.cgi">
  <input type="hidden" name="recipient" value="your login id here">
  <input type="hidden" name="subject" value="subject of this form">

  <input type="hidden" name="textLabel1" value="email address: ">
  <input type="hidden" name="textLabel2" value="name: ">
  <input type="hidden" name="textLabel3" value="hat size: ">
  <input type="hidden" name="textLabel4" value="url: ">
  <input type="hidden" name="textLabel5" value="comments: ">

  <label>Email Address:</label>
    <input type="text" name="field1" size="20"><br>
  <label>Your Name: </label>
    <input type="text" name="field2" size="20"><br>
  <label>Hat Size: </label><br>
    <input type="radio" name="field3" value="small"> Small
    <input type="radio" name="field3" value="medium" checked> Medium
    <input type="radio" name="field3" value="large"> Large
    <input type="radio" name="field3" value="wow"> Super Humongoid

  <br>

  <label>What's Your URL?</label>
    <input type="text" name="textfield4" size="20"><br>

  <label>Any Comments?</label><br>
    <textarea name="textfield5" rows="7" cols="45"></textarea>

  <br>

  <center>
    <input type="submit" value="Send">
    <input type="reset" value="Erase">
  </center>
</form>
  

This is How the Above For Would Appear on Your Page

Resulting Email Message

Below is a sample of what the email message might look like for the above form.

Date: Wed, 28 Jun 1995 15:37:09 -0700
From: nobody
Subject: Whatever you put in the Subject Line
Email Address: joeuser@somedomain.com
Real Name: Joe User
Hat Size: WOW
URL:
Comments: These could be comments on a web page, a request for more information, or just about anything else you would want.

------------------------

Remote host: some.domain.name
Remote IP address: 127.0.0.1

Advanced Form Controls

Define the "Back to" Text

To define the back to text, add the following before the Submit and Clear buttons:

  <input type="hidden" name="ReturnToTag" value="Acme Widgets">
  <input type="hidden" name="ReturnToURL"
    value="http://www.acmewidgets.com">

This will create a page that basically says thank you and provides a link for the visitor to follow. If you want to have the visitor be automatically redirected to a specific page once they have submitted the form use the following:

  <input type="hidden" name="ReturnToTag" value="Acme Widgets">
  <input type="hidden" name="ThankYouURL"
    value="http://www.avvanta.net/~username/thank_you.html">

Required Fields

To force a field to be filled out you will need to define which fields are required. Write the form according to the instructions, but define the required fields as follows after you have defined the TextFields:

  <input type="hidden" name="Required" value="TextField1,TextField2">

Buttons, Check Boxes and More

For each of these buttons/boxes/etc you will need to define the Field and Label as you would for anything else. These examples are not operational, just an example of how they will appear. When the following code is incorporated into an acutal FormMail script, the buttons will work as they are supposed to.

Radio Buttons

  <input type="radio" name="TextField3" value="Apples"> Apples
  <input type="radio" name="TextField3" value="Pears" checked> Pears
  <input type="radio" name="TextField3" value="Oranges"> Oranges
  <input type="radio" name="TextField3" value="Kumquats"> Kumquats

This will appear as

Apples   Pears   Oranges   Kumquats  

Check Boxes

  <input type="checkbox" name="TextField3"> I like Pears

This will appear as:

I like Pears

Select Boxes

  <select name="TextField3">
    <option> Apples
    <option> Pears
    <option> Oranges
    <option> Kumquats
  </select>

This will appear as:

Additional Assistance

If you are unable to get your form working properly, you may search the Avvanta site for additional form pages from the Search box at the top of the page. You may also consult our Web Space FAQ or send email to Avvanta Support.

Our support staff is also available by telephone at (425) 818-6500 or toll free at 888-662-5274.