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 http://members.valley.net/cgi-bin/form.cgi is that program. When you create a web page which uses forms, you will need to link it to the http://members.valley.net/cgi-bin/form.cgi 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, kyle.smith@valley.net. 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 domain.services@valley.net.

 

 

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

This command starts the form.


<FORM METHOD="post" ACTION="http://members.valley.net/cgi-bin/form.cgi">


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


<INPUT TYPE="hidden" NAME="url" VALUE="http://www.yourdomain.com/result-page.html">


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


<INPUT TYPE="hidden" NAME="email" VALUE="your_name@valley.net">


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="user@host.com">


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.


<HTML>
<BODY>

<FORM METHOD="post" ACTION="http://members.valley.net/cgi-bin/form.cgi">

<INPUT TYPE="hidden" NAME="url" VALUE="http://www.yourdomain.com/result-page.html">
<INPUT TYPE="hidden" NAME="email" VALUE="your-name@valley.net">
<INPUT TYPE="text" NAME="from" VALUE="user@host.com">
<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:

<DL>

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

</DL>

Select your Age:

<SELECT NAME="age">

<OPTION>5-15
<OPTION>16-25
<OPTION>26-35
<OPTION>36-45
<OPTION>46-55
<OPTION>56-65
<OPTION>66-75
<OPTION>76-85
<OPTION>86-95

</SELECT>

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

<!-- 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">

</FORM>

</BODY>
</HTML>