The Wayback Machine - https://web.archive.org/web/20090609124200/http://www.webreference.com:80/html/tutorial13/10.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / html / tutorials / 13 / 10

index123456789101112131415161718192021exercises1

Tutorial 13: Giving Form to Forms

Developer News
Rails 3 Gets Supersized With Merb
SpringSource, Hyperic Merge for App Management
Get Ready for Windows 7 'Release Candidate'

Hidden controls

Hidden controls are not displayed and cannot be manipulated by the user, nor can their value be changed. They are used to supply a fixed name/value pair along with the rest of the form. This could be useful if the program that processes the submission does a number of things, but you want the specific form to do only a subset of these. Hidden controls have a TYPE of hidden. For instance, a program that subscribes and unsubscribes people from a mailing list might have a field called action that could have the value subscribe or unsubscribe, and you want to make a form that only allows unsubscribtion. You could do this with something like:

<FORM METHOD="POST" ACTION="/cgi-bin/html/formdump.cgi" 
      ENCTYPE="multipart/form-data">
<P>To unsubscribe, enter your e-mail address:
<INPUT TYPE="text" NAME="email" SIZE="30">
<INPUT TYPE="submit" VALUE="Submit">
<INPUT TYPE="hidden" NAME="action" VALUE="unsubscribe">
</FORM>

To unsubscribe, enter your e-mail address:

A form that offers the user a choice instead could be something like this:

<FORM ACTION="/cgi-bin/html/formdump.cgi" 
      METHOD="GET" ENCTYPE="application/x-www-form-urlencoded">
<P>Enter your e-mail address:
<INPUT TYPE="text" NAME="email" SIZE="30">
<P>Subscribe
<INPUT TYPE="radio" NAME="action" VALUE="subscribe">
Unsubscribe
<INPUT TYPE="radio" NAME="action" VALUE="unsubscribe" CHECKED>
<INPUT TYPE="submit">
</FORM>

Enter your e-mail address:

Subscribe Unsubscribe

index123456789101112131415161718192021exercises1

Produced by Stephanos Piperoglou

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info
Copyright 2009 WebMediaBrands Inc. All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Thickbox 3.1 · User Personalization with PHP: The Admin Section · Debugging JavaScript: Beyond Alerts
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Meru Releases E(z)RF 2.0 · Intel to Host Live Nehalem Q&A; · A Clear Take on WiMAX

URL: http://www.webreference.com/html/tutorial13/10.html

Created: May 28, 1998
Revised: February 25, 1999

Morty Proxy This is a proxified and sanitized view of the page, visit original site.