Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Forms: Check Box
     [next Lesson]  Forms: List Box

Forms - Radio Buttons  (by John Kauffman)

All of your user input objects in a form must have their own unique name which will be the label that the browser will assign to them when passing the data to ASP. The exceptions are radio buttons. Since only one piece of information will be passed to ASP from a set of radio buttons, they all get the same name. HTML requires that one of the buttons is selected by default, the one indicated by the CHECKED command. It is important to understand that the browser will send back to ASP the name and the value of the one button which is selected by the user. The browser will NOT send back the text which is associated with the button. For the example above, if the user checked on the button with the text New York City, then ASP would receive City=NY.

   filename=/learn/test/FormRadio.asp

<Test Script Below>


<html><head>
<TITLE>formRadio.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<form action="FormRadiorespond.asp" method="post">
<p><b>Radio Buttons </b> example</p>
<p>Which Regional Office will you be visiting?</p>    
<input TYPE="radio" NAME="City" VALUE="NY">New York City
<input TYPE="radio" NAME="City" VALUE="LA">Los Angeles
<input TYPE="radio" NAME="City" VALUE="SV" CHECKED>Savannah
<br><input type="submit" value="choose a city">
</form>
</body></html>

The responder looks like:

   filename=/learn/test/FormRadiorespond.asp

<Test Script Below>


<html><head>
<TITLE>formradiorespond.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<%myCity = request.form("City")
Select Case ucase(MyCity)
case "NY"
    response.write "New York meeting is on Jan 3"
case "LA"
    response.write "LA meeting meeting is on Jan 15"
case "SV"
    response.write "Savannah meeting is on Jan 20"
End Select%>
</body>
</html>

There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.