The <form> tag is required to let the browser know that this is a form. Netscape may not even show any of your form elements if this is missing. While IE may show them, the form will be useless without it.
action
where to send the form when it's done
This is usually either the URL of a cgi or asp program or else the name of javascript function that does something with the form data.
"get" or "post".
If you are using a program written by someone else. they will specify which one to use. It does matter.
Of course you need to remember to close your form with a </form> tag.
Types of input (possible values for type):
Examples: <input type="text" name="firstN" value="Dorothy"> first name first name What's your email address? <input type="text" name="email" value="" size="8" maxlength="4"> What's your email address?
Example: <input type="hidden" name="secretcode" value="You'll have to view source to even know I'm here!">
Note: as in all these tags, the value in the tag and the text next to the choice can match but do not have to match. It is wise to make it something that you will not be confused by when you read the results. Examples: <input type="radio" name="sample" value="a">armadillos <input type="radio" name="sample" value="b">badgers <input type="radio" name="sample" value="c">coyote <input type="radio" name="sample" value="d" checked>dogs
armadillos badgers coyote dogs
Examples: avocado<input type="checkbox" name="sample" value="avocado"> bacon <input type="checkbox" name="sample" value="bacon"> cream <input type="checkbox" name="sample" value="cream"> eggs <input type="checkbox" name="sample" value="eggs" > avocado
bacon cream eggs
If you set the value equal to something, that is what the face of the button will say. If value is not set it will say "Submit Query".
Name may be needed if the form has more than one submit button. Otherwise it probably isn't.
Examples: <input type="submit" value="funny name"> <input type="submit" name="basic">
Using a reset button clears all data that the user entered in the form and discards it.
Examples: <input type="reset"> <input type="reset" name="evil one" value="Submit">
Examples: <input type="password" maxlength="6" size="6" name="pin" > <input type="password" name="userpass" >
Name works just like in all the other tags.
Set size by setting the number of rows and cols.
this one needs a closing tag!! To set a default value, type it inbetween the opening and closing tags.
Examples: <textarea name="name of text area" rows="3" cols="45" > </textarea>
<textarea name="comments" rows="8" cols="60" >Tell us about yourself: </textarea> Tell us about yourself:
<textarea name="tiny" > </textarea>
Examples: <select name="choices" size="4" multiple> <option>One of my choices</option> <option>Choose one</option> <option>Or choose many</option> <option>Another choice</option> <option>Yet another</option> <option>still another!</option> <option>as you like</option> </select>
One of my choices Choose one Or choose many Another choice Yet another still another! as you like
<select name="state" size=1> <option>Pick a state</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="CA">California</option> <option value="ID">Idaho</option> <option value="NV">Nevada</option> <option value="OR">Oregon</option> <option value="UT">Utah</option> <option value="WA">Washington</option> </select>
Pick a state Alaska Arizona California Idaho Nevada Oregon Utah Washington
Return to Top