How to Setup Forms on a Web Page

ValleyNet has provided you with an easy-to-use CGI form script. Forms on web pages do not work unless you have linked them to some program or script on the server. The form.cgi script provided at is that program. When you create a web page which uses forms, you will need to link it to the script in order for the information to be sent to your email address.

You will find the basic information you need in the information and sample code provided below. Copy, paste, and modify the code (with your specific settings) into your form web page.

CAUTION: If you are using a "What You See is What You Get" web design program like Front Page, do not paste this text into the Design Window (this will just write your page so it shows all this code to the user). Instead, find out how to view source code (or html) inside your design program and paste the following information into *that* window. Make the necessary changes (your domain and your email address) right in the source code (or HTML) window. Now you are ready to go back to the design window and add or remove fields and other elements in your page.

Please note that this CGI is placed here as a service to ValleyNet users. If you would like to use it on other servers, please contact the the author, Though Valley Net does not officially provide support for writing CGI scripts or web pages, if you need some basic help/support in getting your web page or form running, please contact



Explanation of the HTML code used with the form.cgi script:

This command starts the form.


This command specifies a URL that will be shown to the user after submitting the form. Replace with your real domain. (Optional)

<INPUT TYPE="hidden" NAME="url" VALUE="">

This command specifies a mail address that will receive the form results. Replace with your real e-mail address.

<INPUT TYPE="hidden" NAME="email" VALUE="">

If your form contains a field called "from" where the user can enter their e-mail address the contents will be used as the return address for the e-mail message.

<INPUT TYPE="text" NAME="from" VALUE="">

When you receive the results of the form by email, you can specify a distinctive Subject header that the results should contain.

<INPUT TYPE="hidden" NAME="subject" VALUE="Form Results!">

If you want to make certain fields required, add them to the VALUE section of this option (be sure to separate multiple fields with a comma). (Optional)

<INPUT TYPE="hidden" NAME="require" VALUE="name,gender,age">

If you want the form results sorted in some way, you can use the following option. (Optional)

<INPUT TYPE="hidden" NAME="sortorder" VALUE="name,gender,age,address">

The following is an example HTML document which uses forms and the form.cgi script. Feel free to copy and modify the code below to handle your web form needs.



<INPUT TYPE="hidden" NAME="url" VALUE="">
<INPUT TYPE="hidden" NAME="email" VALUE="">
<INPUT TYPE="text" NAME="from" VALUE="">
<INPUT TYPE="hidden" NAME="subject" VALUE="Form Results!">
<INPUT TYPE="hidden" NAME="require" VALUE="name,gender,age">
<INPUT TYPE="hidden" NAME="sortorder" VALUE="name,gender,age,address">

Input Your Name <INPUT TYPE="text" NAME="name" VALUE="Fred">

Your Gender:


<DD><INPUT TYPE="radio" NAME="gender" VALUE="Female"> Female<BR>
<DD><INPUT TYPE="radio" NAME="gender" VALUE="Male"> Male<BR>


Select your Age:




Your Address:
<TEXTAREA NAME="address" ROWS=4 COLS=40>ValleyNet
One Montshire Road
Norwich, VT 05055

<!-- A submit button, so the user can send off the form. -->
<INPUT TYPE="submit" VALUE="Submit Form">

<!-- A reset button, to clear the form. -->
<INPUT TYPE="reset" VALUE="Clear This Form">