Return to our main pageGet an overview of the 100s of pages on this siteAn alphabetic index of our 100s of pagesSearch this siteby email, snail-mail or phoneThe people at NetKontoret

Tutorial and Inspection of your own siteTutorial and Script-archiveTutorial and Applet-archiveTutorial and FLA-archiveTutorial and Graphics-archiveFree Email, Webspace, Programs, Applets, Graphics and CGIWebdesign, Teaching and Consulting

 
 Home|WebSchool|HTML|Forms



Click To Recomend This Site To A Friend
Tell a friend about this site!!!

Bookmarks on this page

 
 CGI-Scripts
 
 Form-tag
 
 Form-fields

Pages in this section

 
Basic Coding
 
Text
 
Lists
 
Images
 
Links
 
BackGrounds
 
Tables
 
Frames
 
Forms
 
Metatags
 
Hexcolors
 
Inspect your own site
 
Others & Links


HTML FORMS

pixel.gif (43 bytes) d10.gif (111 bytes)



Forms

Forms can be compared to the paperforms you get to fill out all the time.

A form is simply an area on your website that is considered by the browser to contain a set of information.

There really are no limits concerning what you can do with the content of the form once it is entered and submitted.

Usually it is either sent as an email, as an input to a database or as an input to a webpage.

In any case, what really happens when a form is submitted, is that a so called cgi-script (a program that runs on a server) receives the data and then handles the data the way the program was programmed to do.

Top of page


CGI-SCRIPTS
A very popular cgi-script to use in combination with forms is the "formmail.cgi", a small program that simply forwards the content of the form to a desired mailaccount.

Another popular example of cgi-scripts used in combination with forms is the "guestbook.cgi", a program that adds the text submitted by the form to a html-page, which will thus work as a guestbook.

The triggy part about forms is, that usual you are not allowed to run your own cgi-scripts on the server.

However, most of the popular scripts are hosted for free around the net. (for instance our cgi-section also provides resources for free form proccessing).

You do not need to program your own cgi-scripts. In fact you don't even need to have cgi-scripts on your own server to use them. You can always use of the free cgi-scripts if you cant run scripts on your own server or if you don't know how to program them.

Note: Many internetproviders hosts standard scripts such as formmail and guestbookscripts, for their customers to use. Make sure to check out which scripts are offered by your own ISP (Internet Solution Provider).

The reason internet providers usually do not allow customers to run their own scripts is:

1) that a bad script in the worst case can lay down the entire server, and

2) running scripts on a server, gives pretty good possibillities for hacking the server, to gain access to sites you really shouldn’t have access to, and finally

3) accepting customers scripts usually means accepting way more administration than elsewise - this is the reason that most providers that do allow customized scripts charge higher prices.

To summarize this section: All forms works in combination with programs that runs on a server (cgi-scripts). If you can noit run your own scripts, check out our section of free remotely hosted scripts.

Top of page


THE FORM-TAG:
In order to tell the browser where your form starts and where it ends you simply add these tags in your HTML-codes:

<form>
</form>

Note: Unlike a table, forms are not visible on the page.
The area of the page covered by the form can not be seen by the visitors to the page.
Some pages has several forms that appears to the visitor as if they were one, while others have one form that appears as if it was several.

You can add all kinds of HTML-tags between the <form> and </form>-tags.
This means that a form can easily include a table or an image along with the formfields mentioned underneath.

The form entered above is useless for two obvious reasons:

   First it contains no formfields- it is simply comparable to a blank sheet of paper.
   Second, it does not contain a recipient for the form once it is submitted.

To let the browser know what to do with the content of the form, once it should be submitted we add properties to the <form>-tag:

action=address

method=post or method=get

address is the url of the cgi-script the content should be sent to.
post and get is simply two different methods for submitting data to the script.

If you are using a pre-programmed script (which we assumes here) it is not important to understand the difference between get and post.

In the description of the script you are using it will be made clear whether the scripts should be adressed using the one method or the other.

Below is an example of a form that uses the script at

www.netkontoret.dk/cgi-bin/formmail.cgi

to handle the content submitted from the form.

<form method="post" action=http://www.netkontoret.dk/cgi-bin/formmail.cgi>
</form>

So now that we have added an action to the <form>-tag, we only need to allow the visitor to enter some information. The next section explains how to do that.

Top of page


FORMFIELDS:
The form mentioned above is still useless.

It will never be submitted since it does not contain a submit-button.

A submitbutton is simply a button that, once clicked, starts the action mentioned in the above section - which is: send the content of the form to the cgi-program.

Furthermore, our form still does not contain any form-fields.
Even if it had a submit-button, there really wouldn’t be anything to submit.

To enter formfields and buttons to your from you should use the <input>-tag.

To insert a submit-button on your form, add these tags:

textarea
 
rows=
  cols=
  name=
  Wrap=

     off
     virtual

     physical
Textfield covering several lines
rows in the field
columns in the field
Name of the field


Turns of linebreaking
Shows linebreaking, but
sends text as entered
Insterts linebreaks when needed and even sends it.
text
 
size=
  maxlength=
  name=
  value=
One line text-field
Characters shown
Max characters allowed.
Name of the field
Initial value in the field
password
 
size=
  maxlength=
  name=
  value=
Passwordfield.
Characters shown
Characters allowed to enter.
Name of the field
Initial value in the field
checkbox
 
name=
  value=
Choose one or more options
Name of the field
Initial value in the field
radio
 
name=
  value=
Choose only one option
Name of the field
Initial value in the field
select
 
name=
  size=
  multiple=

option
 
selected
  value=
Drop-down-menu
Name of the field
Number of items in list
Allows multiple choices if yes

Individual items in the menu.
Make an item default.
The value that will be sent if item is choosen.
  hidden
 
name=
  value=
Does not show on the form.
Name of the field
Value that will be sent when form is submitted
reset
 
name=
  value=
Button to reset all fields
Name of the button
Text shown on the button
submit
 
name=
  value=
Button to submit the form
Name of the button
Text shown on the button
image
 
name=
Image that works as a button.
Name of the image

 


Top of page


An example:

Comming soon

 

Click To Recomend This Site To A Friend
Tell a friend about this site!!!

d10.gif (111 bytes) pixel.gif (43 bytes)



     

menumidline.gif (281 bytes)



| Home | SiteMap | Index | Search | Contact Us | About Us | E-Mail Us |
| HTML | JavaScript | Applets | Flash | Graphics | Free Stuff | Products |


This page is created & maintained by NetKontoret / Henrik Petersen
All contents Copyright © 1997, 1998 - NetKontoret / Henrik Petersen - All Rights Reserved