Web Development HTML Guide - Learn HTML
Developer Tutorials
ASP
CGI & Perl
CSS
Flash
HTML
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML



Developer Manuals
Learn HTML
Learn PHP
Learn MySQL
Learn CSS
Learn Pear


Developer Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Developer Resources
Developer Tools
Developer News
Developer Forums
Developer Content
Developer Book Reviews
Survey Software

Web Hosting Directory
Budget Web Hosting
ColdFusion Hosting
Dedicated Servers
Domain Hosting
E-Commerce Hosting
Email Hosting
Free Web Hosting
Linux Web Hosting
Managed Hosting
Reseller Hosting
Small Business Hosting
Windows Web Hosting

Attribute for <INPUT ...>
VALUE

VALUE sets the value for the input field. VALUE sets the default values for text and password fields, sets the button text in submit, reset and plain buttons, sets the values of the choices in radio buttons, sets the permanent values of hidden fields, and has no effect on file, and image fields.
text and password fields
For these types of fields, VALUE sets the default value:

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">

name: <INPUT TYPE=TEXT NAME="realname" VALUE="wisnesky"><BR>
password: <INPUT TYPE=PASSWORD NAME="realname" VALUE="pacman">

<P><INPUT TYPE=SUBMIT VALUE="submit">
</FORM>
name:
password:

It's a bad idea to send a default password, because the password can be obtained by looking at the HTML code.

radio buttons
use different values among several inputs with the same NAME to indicate different options:

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">

<INPUT TYPE=RADIO NAME="color" VALUE="red"    >Red<BR>
<INPUT TYPE=RADIO NAME="color" VALUE="green"  >Green<BR>
<INPUT TYPE=RADIO NAME="color" VALUE="blue"   >Blue<BR>
<INPUT TYPE=RADIO NAME="color" VALUE="purple" >Purple

<P><INPUT TYPE=SUBMIT VALUE="submit">
</FORM>
Red
Green
Blue
Purple

submit, reset, and plain buttons
The text in these types of buttons is set using VALUE.

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">

<INPUT TYPE=BUTTON VALUE="My Plain Button"  ><P>
<INPUT TYPE=RESET  VALUE="My Reset Button"  ><P>
<INPUT TYPE=SUBMIT VALUE="My Submit Button" >

</FORM>

If you can use the NAME attribute with submit buttons to make them act similar to radio buttons:

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">
Go to the check-out page? <BR>
<INPUT TYPE=SUBMIT NAME="checkout" VALUE="YES"> 
<INPUT TYPE=SUBMIT NAME="checkout" VALUE="NO"> 
</FORM>
Go to the check-out page?

See RADIO for more details.

checkboxes
VALUE does not effect the checked state of checkboxes. If you want a checkbox to default to on, use CHECKED. Instead, VALUE sets the value that is sent to the server if the user checks that checkbox. For example, if you wanted the checkbox to send yessireebob you could set the checkbox like this:

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">

<INPUT TYPE=CHECKBOX NAME="join" VALUE="yessireebob">
yes, sign me up!

<P><INPUT TYPE=SUBMIT VALUE="join">
</FORM>
yes, sign me up!

If the checkbox is not checked, no value of any kind is sent to the server. By default, checkboxes send on.

hidden fields
Hidden fields have no purpose unless they have a value (they also need a name).

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">

<INPUT TYPE=HIDDEN NAME="threadID" VALUE="1295">

<P><INPUT TYPE=SUBMIT VALUE="submit">
</FORM>


Copyright Idocs, Inc. Written by Miko Sullivan











About the NetVisits, Inc Network | Advertise
Developer Tutorials hosted by HostGator.
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: