Home Yellow Pages Movies Classifieds Jokes Jobs Free Hosting Videos




Lesson 1

Introduction

<FORM> tag adds interactivity to your web documents. With the form tag you can add to your web pages a guestbook, order forms, surveys, get feedback or whatever.

The basic construction of a html form is

<FORM>    begin a form

<INPUT>   ask for information in one of several different ways..

<INPUT>    ...there can be as many input areas as you wish

</FORM>   end a form

Forms collect data and email it to the Email address mentioned. This can be done in two ways - using a CGI Script or using mailto action. The following code sends the data to an Email address mentioned in the mailto. You can send the data to more than one email address, separate them with commas.

The mailto forms can be a little troublesome and/or unreliable for a small percentage of your visitors. A mail script is the perfect solution to this problem.

Open Notepad and copy the following, save it some folder as form.html and call it in a browser.

<HTML>
<HEAD>

<TITLE>My first web page with form</TITLE>

</HEAD>

<BODY>

<FORM METHOD=POST ACTION="mailto:info@bizhat.com" ENCTYPE="text/plain">
</FORM>

</BODY>

</HTML>
CGI Form Handling

The most reliable way to process your form data is to send it to a script on a server for processing. The most obvious place to look for such a script is your own ISP or web host. Most have a form mail script that you can send the data to.

Another option (only if you have access to your server's CGI bin) is to run your own script. Here again are places where you might be able to find a script.

http://www.cgi-resources.com/Programs_and_Scripts/

http://www.artsackett.com/freebies/asform/

To make things a little cleaner I will write only what is within the <FORM> tags. Needless to say, have head, body, title and form tags in your document.

The most common TYPE of form <INPUT> is TEXT. Every input needs a NAME.

<INPUT TYPE=TEXT NAME="studentname">

When the user types in, it will become the input's value and be paired with studentname. (E.g. - studentname=Edwin)

We can set a default studentname if desired

<INPUT TYPE=TEXT NAME="studentname" VALUE="Edward">

studentname will be Edward, unless the user changes it.

We can specify the size of the text input box.

<INPUT TYPE=TEXT NAME="studentname" VALUE="Edward" SIZE=30>

Will form an input box having 30 pixel in length with Edward as studentname. The default value of size of the text input box is 20.

PASSWORD

<INPUT TYPE=PASSWORD NAME="USER PASSWORD">

Very similar to the TYPE=TEXT is the TYPE=PASSWORD. It is exactly the same, except it displays *** instead of the actual input. The browser will send you the input, it just won't display it. SIZE, VALUE, and MAXLENGTH attributes work here also.



<--HOME        NEXT-->

BizHat.com   Bookmark   Astrology   Chat Room   Classifieds   Computer   Downloads   Directory   Dating   Domain Tools   Education   eCards   Finance   Forums   Freelance Work   Free Hosting   Free Mail   Gallery   Games   Guest Book   Greeting Cards   Ham Radio   Health   Home Business   Hosting Tutorials   Hosting Directory   India   Jobs   Jokes   Kerala   Matrimonial   Music   Movies   News   News Letter   Recipes   Real Estate   Search   SMS   Tourist Guide   Top 100 Sites   Vote Us   Yellow Pages   Arthunkal Church   Site Map  

Google