Webmaster Resources Center

Welcome to the Bravenet Resource Center. Use these resources to help make your web pages more advanced and fun to use.

Articles & Tutorials

Forms - Understanding Form Basics

by Bravenet.com

Summary : These tutorials provide a step by step walk-through of how to build each element for your form.

The Bravenet Email Forms service uses standard HTML Form elements to create your actual form, and our special form processing script handles all of the delivery and message processing for you! We provide you with a very basic HTML form which you can customize to suit your own needs with standard HTML form tags.

These tutorials provide a step by step walk-through of how to build each element for your form.

HTML Forms require the use of a <form> tag and a variety of input field tags. The <form> tag determines what the form does with the information provided by a visitor. Some forms will email the information directly to an email address and some forms collect and send information to a database for further use, like a Guestbook.

Regardless of what happens to the information, the actual processing is usually handled behind the scenes by a 'form processor'. Most form processors are small scripts stored on a webserver that are written with specific instructions that process form information in specific ways. The <form> tag defines which form processor script will be used and passes the information to the processing script.

All forms require a <form> tag and some attributes to make it work properly.

Let's write a basic <form> tag, step by step, to show how the tag is correctly coded. First we start with the opening form tag:


Then we need to define the method used to deal with the form data. In this case we are 'sending' or 'posting' the data from the form, to another process.. so we use the post method:

<form method="post"

Now we need to specify the way we are going to process the data entered into the form by a visitor. We do this using the action attribute. This tells the form which action to perform on the visitor information.

There are 3 ways we can define the action attribute:

  1. Hosted Script - processing script hosted by a provider like Bravenet.
  2. Mailto - sends all the information to the email address that you specify.
  3. Server Script - a special form processing script stored on your webserver.

The hosted script uses a script stored on someone else's webserver, processes the form data on the other server and then emails you the results. Bravenet provides hosted form processing scripts to all members. The code that we provide already has the correct action defined for you.

The example below shows a sample of Bravenets Hosted Script complete with the full url and name of the form processing script. The pub number in your code will depend on what pub number is assigned to your member account:

<form method="post" action="http://pub39.bravenet.com/emailfwd/senddata.php">

Bravenet forms also require that two extra tags be included in your coding. The usernum and cpv hidden input tags are required and your form will not work if you remove them from the form coding. Your full Bravenet form tag(s) will look like this:

<form method="post" action="http://pub39.bravenet.com/emailfwd/senddata.php">
<input type="hidden" name="usernum" value="3331347006" />
<input type="hidden" name="cpv" value="2" />

The mailto action takes all of the raw data from your form and emails it, as is, to the email address you specify. (Note: The mailto form action does not work in all browsers. ) It is coded like this:

<form method="post" action="mailto:yourname@yourdomain.com">

The server script uses a small form processing script stored on your webserver to process and format the information your visitors have provided, in a more organized and readable format than the basic mailto option shown above.

To use a script stored on your webserver just add the path to the server script, and add the filename of the processor script. In the example below, the script is stored in a folder called 'cgi-bin' and the script is called myscript.pl. It is coded like this:

<form method="post" action="cgi-bin/myscript.pl">