
How check box values can be accessed in the form processing
scripts? |
For the user interests example, you might ask the users to choose what product lines they are interested in. You then might list several product lines such as Home Electronics, Major Appliances, and Stereos. It would be nice to have a series of check boxes next to each product line name, so that the user could check the product lines that interest them. In this example, wed have three check boxes, one for each of the three product lines.
Check boxes are created with the<input> tag. For a check box, you need to set the TYPE property to TYPE=CHECKBOX. The NAME property is slightly different for check box. Rather than having a unique NAME for each check box, you can group check boxes by giving them all the same NAME. In the product line examples, you would want to give all three check boxes the same NAME. The VALUE property needs to be unique among check boxes that have the same NAME. The VALUE property is what the form processing script will receive when referring to check box group.
Lets write some HTML to create a form to query users about their interests in the three product lines. The code will create three check boxes. When creating a check box, the <INPUT> tag only creates the check box. You need to use HTML to label the check box.
<HTML>
<BODY>
<FORM METHOD=POST ACTION=/scripts/somefile. asp>
What product
lines are you Interested in? <BR>
<INPUT TYPE= CHECKBOX NAME= Product
Line VALUE=HOME Electronics>
Home Electronics
<BR>
<INPUT
TYPE= CHECKBOX NAME= Product Line VALUE=Major Appliances>
Major
appliances
<INPUT TYPE=CHECKBOX NAME=Product Line VALUE=Stereos>
Stereos
<p>
<INPUT
TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
It can create three check boxes. Recall that checkboxes are created using the <INPUT>tag with TYPE property set to CHECKBOX. IN 5, 8, AND 11 we create our three related checkboxes, each with the same NAME.
Each
check box in the group of related checkboxes will be uniquely identified in the
form processing script via the INPUT tags VALUE property.
_______________________________________________________________________
FREE
Subscription
Subscribe to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________ Recommended
Resource
through email. Keep yourself updated with latest
developments in the industry.
anyone.
We assure that your privacy is respected
and protected.