webdesign
webmarketing
webmarketing links
referenzen

Schulungsunterlagen:

links für webdesigner
dreamweaver
photoshop

ITH Tutorials:
webdesign
webmarketing


HTML Forms

What are forms and what can I use them for?
HTML Forms are used to gather information from visitors. A basic HTML Form is made up of a variety of elements such as input fields, radio buttons and checkboxes. Forms have a wide variety of uses.

How does a form process information?
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.

Most webhosts already store a selection of form processing scripts on their servers that you can access and use to power and manage your HTML forms. The most common form processors are small 'CGI scripts'. Contact your webhost for details on what form processors are available to you to use with your forms, and how to properly implement them.

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:

<form

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

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

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 Bravenet action 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://pub##.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://pub##.bravenet.com/emailfwd/senddata.php">
<input type="hidden" name="usernum" value="123456789" />
<input type="hidden" name="cpv" value="1" />

top


Further more informations you will find on Bravenet

 

time2goweb.com webdesign webmarketing // christine wörndl // staufenstraße 3, 5071 wals-siezenheim
tel.: +43 - 0699/12243867 // mail: info@time2goweb.com // UID ATU 56595722 // e-commerce richtlinien