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 ...>
NAME

NAME assigns a name to the input field, and is required in most circumstances. In forms which use CGI, the name of the input field is sent to the CGI:

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

favorite color: <INPUT NAME="favecolor">

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

For radio buttons and submit buttons you can use the same name in more than one input to indicate different options. Notice in these examples that the names are the same but the values for each option change:

this code produces this
<FORM ACTION="../cgi-bin/mycgi.pl">
What size pizza?<P>

<INPUT TYPE=RADIO NAME="pizzasize" VALUE="S">small<BR>
<INPUT TYPE=RADIO NAME="pizzasize" VALUE="M">medium<BR>
<INPUT TYPE=RADIO NAME="pizzasize" VALUE="L">large<P>

<INPUT TYPE=SUBMIT VALUE="submit">
</FORM>
What size pizza?

small
medium
large

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

Forms that use scripting also use NAME. The input object is in the elements collection of the form object, and can be referred to by its name using dot notation. In this example, we use the this.form.email to refer to the email input field. This code requests an email address. If none is given, the form is not submitted.

<FORM 
    ACTION="../cgi-bin/mycgi.pl" 
    onSubmit="return (this.email.value != '')"
    >

email: <INPUT NAME="email">

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

which gives us

email:


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: