Email Forms

  • Use view source to see the form example here: Form example 1

  • Demonstrates an type of e-mail form which uses the "FormMail" script provided for free by Matt's Script Archive. This is the script that my web publishing provider (http://www.mesagroup.com/) recommends and provides for my use. Each web hosting provider usually has a slightly different e-mail form script that they provide for your use. Check with your web hosting provider to see which one they want you to use. Because of security risks, some web hosting providers might not allow e-mail forms to be used.

    To transfer the form you create for my class to another service provider, you'll have to change some things.

  • You can have one or more forms on any given web page. Each form must have its own submit button within the form start and end tags.


    Form start tag (Post)

    <FORM METHOD=post ACTION="/somepath/somescript.cgi">
    if using the POST method

    Note: the path and name of the script will vary depending on which server you are using to host your form.

    Form start tag (Get)

    <FORM METHOD=get ACTION="/somepath/somescript.cgi">
    if using the GET method

    The post method is generally preferred because it keeps the field names and values hidden from the user, while the get method display the field names and values to the user by appending them to the URL in the form ?field="value".

    The example form uses the Post method

    Form end tag

    </FORM>

     

  • Required or Reserved Field Names: Each e-mail script has certain field names that are required or reserved and treated specially by the script. Here's a list of the one's that are special on my server:


    recipient

    On the example given, this is a hidden field (not displayed to the person filling out the form). This tells the form script where to send the e-mail. It would be dangerous to display this field, because then spammers (people who send out bulk, unsolicited e-mails) would be able to use your form to spam people. If people were using your form to send unsolicited e-mails, you could get kicked off of your web hosting provider (due to complaints).


    email

    On the example given, this text input field of length 60, maximum 80 characters. This allows the user to type in their e-mail address and when I receive the contents of their form via e-mail, I can just use the reply button to reply back to them.

    Note: this feature is not supported by all web servers. On some, like Cruzio, the e-mail message will be sent to you by the web server, so if you accidently hit "Reply" the web server system admin would get your reply, not the person filling out the form.


    reaname

    this is where the person filling out the form puts their full name. When you receive the e-mail from the form, their name will appear in the "From" header of the e-mail. This is also a text input field of length 60, maximum length 80 characters.


    subject

    This can either be a hidden field or, one that you allow the user to set. In this example, it is a hidden field so every form that is filled out comes to your e-mail box with the same subject.


    message

    This is set up as a field of type "Textarea" to allow for more than one line of input. This is kind of like the body of a regular e-mail message.


    redirect

    This is a hidden field in the example which determines the page that the user will receive after filling out the form. That page could be any page. In this example, I have returned them to my index.html page using absolute addressing (needed because the script is running out of a different place on the web server, not from your home directory)

  • note: you can add other fields as necessary, just make sure to not name them a reserved name.
  • The entire readme file for the FormMail script is available for you to read.