Online Forms

To assure the proper operation of online forms, development should be done at html code level. These instructions are presented with html code level develoment in mind.

Form Basics

All forms you create must consist of at least 4 elements for forms.cgi script to work correctly. They are the "opening forms tag", "hidden form fields", "fillable form fields", and "closing forms tag".

Element: opening forms tag
Description: This tag must be the first html tag to appear in the body of you webpage where you want your form to begin. It designates where the forms.cgi script is located on the server and what method is used to process the information submitted on the form. The opening forms tag must appear in the exact syntax as shown below.
Syntax: <FORM METHOD="POST" ACTION="http://www.pageweb.com/cgi-sys1/forms.cgi">


Element: hidden form fields
Description: Hidden form fields are not visible to the user through normal use of their browser. They are used by you, the webmaster, to pass certain information to the forms.cgi script such as: to whom you wish the form results to be e-mail to, the URL of the webpage you wish the user to end up on after submission, etc..
Syntax: <input type=hidden name="recipient" value="email@your.host.xxx">

Element: fillable form fields
Description: Fillable form fields are are visible to the users browser. They are used to gather information from the user such as their name, phone number, email address, comments, etc. which will then be email to you or the designated recipient.
Syntax: <INPUT TYPE="text" NAME="name" SIZE=20>

Element: closing forms tag
Description: The closing forms tag must be the last html tag to appear in the body of you webpage where you want your form to end.
Syntax: </FORM>

Necessary Form Fields

There are 4 form fields that you must have in your form for forms.cgi script to work correctly. They are the recipient, subject, redirect & email fields.

Field: recipient
Description: This form field allows you to specify to whom you wish for your form results to be mailed. Most likely you will want to configure this option as a hidden form field with a value equal to that of your e-mail address.
Syntax: <input type=hidden name="recipient" value="email@your.host.xxx">


Field: subject
Description: The subject field will allow you to specify the subject that you wish to appear in the e-mail that is sent to you when the form is submitted.
Syntax: <input type=hidden name="subject" value="Your Subject">

Field: redirect
Description: The redirect field is a hidden field which specifies the URL of a pre-made webpage you wish to be displayed to the user after the form has been submitted. Normally you would specify a Thank You page which contains with a hyperlink back some other page on your website.
Syntax: <input type=hidden name="redirect" value="http://your.address/thank_you.html">


Field: email
Description: The email field is a fillable(non-hidden) form field for the user to specify their return e-mail address. If you want to be able to return e-mail to your user, we strongly suggest that you include this form field and allow them to fill it in. This will be put into the From: field of the message you receive.
Syntax: <input type=text name="email">

Optional Form Fields

Field: required
Description: The required field is a hidden field which allows you to require certain fields on your form to be filled in before the user can successfully submit the form. Simply place all field names that you want to be mandatory into this field. If the required fields are not filled in, the user will be notified of what fields they need to fill in to successfully submit the form. We strongly suggest that the email field discussed above be designated as a required field.
Syntax: If you want to require that they fill in the email and phone fields in your form, so that you can reach them once you have received the mail, use a syntax like:

<input type=hidden name="required" value="email,phone">


Field: sort
Description: The sort field is a hidden field which allows you to choose the order in which you wish for your variables to appear in the e-mail that forms.cgi generates. You can specify a set order in which you want the fields to appear in your mail message. By leaving this field out, the order will simply default to the order in which the browsers sends the information to the script (which isn't always the exact same order they appeared in the form.) When sorting by a set order of fields, you should include the phrase "order:" as the first part of your value for the sort field, and then follow that with the all field names separated by commas.
Syntax: : To sort by a set field order:

<input type=hidden name="sort" value="order:fieldname1,fieldname2,etc...">


Sample Comments Form

Your Comments & Suggestions Are Welcome

   Your Full Name:
           E-Mail:

             Comments & Suggestions: 
             

Sample Comments Form HTML Code

Here is what the html code looks like for the above Comments Form.
<CENTER><H2>Your Comments & Suggestions Are Welcome</H2></CENTER>

<FORM METHOD="POST" ACTION="/cgi-sys1/forms.cgi">

<INPUT TYPE=hidden NAME="recipient" value="sample@pageweb.com">
<INPUT TYPE=hidden NAME="subject" value = "Comments Form">
<INPUT TYPE=hidden NAME="redirect" value = "http://www.pageweb.com/sample/forms/thanks.htm">
<INPUT TYPE=hidden NAME="required" value = "email,name,Comments">
<INPUT TYPE=hidden NAME="sort" value = "order:email,name,Comments">

<PRE>
   <B>Your Full Name:</B><INPUT TYPE="text" NAME="name" SIZE=20>
           <B>E-Mail:</B><INPUT TYPE="text" NAME="email" SIZE=20>

             <B>Comments & Suggestions: </B>
             <textarea name="Comments" rows=3 cols=50></textarea>
</PRE><CENTER><INPUT TYPE="submit" VALUE="Submit Form"> <input type="Reset" value="Clear Form"></CENTER>  
</FORM>

 

 

 

Copyright © 1995-2009 PageWeb.com   All rights reserved.


Web Site Hosting By PageWeb.Com