Web Programming and computer Blog
Latest news

Main Menu

Html Tags List
Meta Tags
Headings
Backgrounds
Inserting text
Text Manipulation
Linking
Images
Tables
Forms
Color Chart
Frames
Example Web Pages
Contactus


Forms

Forms are the most advanced feature in HTML language. Although, it's the easiest solution for creating dynamic mailing forms that will keep you in contact with your visitors. Forms can be used to make surveys, feedbacks or to send orders to the merchant's email.

 

● Add a text input:


<INPUT TYPE="text" NAME="FIRST-ITEM" SIZE=12>

▪ Change the size


<INPUT TYPE="text" NAME="FIRST-ITEM" SIZE=25>

▪ since information in html forms is sent as a name/value pair the text input must have a 'name', the value is whatever the user typed in or a value could be given


<INPUT TYPE="text" SIZE=25 VALUE="hello world">

▪ input password type is very similar exept it displays the * symbol instead of alpha numeric characters
type someting in:

<INPUT NAME="PASS" TYPE="password" SIZE=12>

 


 

Adding Radio buttons:

Subscribe Unsubscribe

<INPUT TYPE="radio" NAME="NEWSLETTER" VALUE="SUBCRIBE" CHECKED> Subscribe
<INPUT TYPE="radio" NAME="NEWSLETTER" VALUE="UNSUBSCRIBE">
Unsubscribe


radio buttons must have a 'value', radio inputs should have the same 'name' because they only give the user one possible option. It is possible to offer the user more options with radio inputs by giving them a different 'name'

Subscribe Unsubscribe
Include attachment Don't include attachment

<INPUT TYPE="radio" NAME="NEWSLETTER" VALUE="SUBCRIBE" CHECKED> Subscribe
<INPUT TYPE="radio" NAME="NEWSLETTER" VALUE="UNSUBSCRIBE">
Unsubscribe
<BR>
<INPUT TYPE="radio" NAME="ATTACHMENT" VALUE="INCLUDE" CHECKED>
Include attachment
<INPUT TYPE="radio" NAME="ATTACHMENT" VALUE="NOT-INCLUDE"> Don't include attachment

 


 

Adding Check Box:

Check boxes are used when you want to let the visitor select one or more options from a set of alternatives. If only one option is to be selected at a time you should use radio buttons instead.

 

Below is a listing of valid settings for check boxes:

 

The name setting adds an internal name to the field so the program that handles the form can identify the fields.

The value setting defines what will be submitted if checked.

The align setting defines how the field is aligned.
Valid entries are: TOP, MIDDLE, BOTTOM, RIGHT, LEFT, TEXTTOP, BASELINE, ABSMIDDLE, ABSBOTTOM.

The tabindex setting defines in which order the different fields should be activated when the visitor clicks the tab key.
 

 

Example:

<form name="formex15" action="http://www.mydomain.com/form.cgi" method="POST">
<div align="center"><br>
<input type="checkbox" name="option1" value="Milk"> Milk<br>
<input type="checkbox" name="option2" value="Butter" checked> Butter<br>
<input type="checkbox" name="option3" value="Cheese"> Cheese<br>
<br>
</div>
</form>

 

This will like this:

Milk
Butter
Cheese
 


 

Submit / Reset buttons:

 

one of the most simple form tags of all, this basic format displays 'submit query' on the submit button

<INPUT TYPE="submit"> <INPUT TYPE="reset">


In this next example 'submit' and 'reset' are given a 'value':

<INPUT TYPE="submit" VALUE="Send">
<INPUT TYPE="reset" VALUE="Clear">

 

Ads

Html Help
Daily Pages that Suck

04/18/2006 10:18 PM
Core PHP Programming 3rd ed
A large (1000+ pages) book containing all you need to know about PHP5 and a dozen of related subjects. Written by Leon Atkinson and Zeev Suraski.
04/18/2006 10:18 PM
Protection from register_globals problems
Sometimes you have to use a PHP application that requires register_globals set to "On". You can safely do this with mod_security. I just wrote a small article (actually it is part of the user manual) explaining how you can do it.

© 2005 Htmlhelps.net, Inc. All rights reserved. Terms of Use and Disclaimer