SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Collecting checked radio button value of a HTML form in ASP

Radio buttons in a form in ASP is used to collect user's choice. Here radio button is used when user has to select one of the many options presented. For example we want the visitor should say the mode of transport he select while traveling. Here one of the four options is to be decided by the visitor so we can use radio button here. As a part of the form component radio buttons can be used along with other components of a form. We will discuss here only the handling of radio button in a form and collecting the radio button value through ASP.

A group of radio buttons will have same name but different values. In a form there can be any number of groups of radio buttons but each group of buttons will have same name.

We will try here with one group of radio button giving the visitor to select one choice but same can be extended to more than one group of radio buttons. Here is the code to display a group of radio buttons inside an html form.

<form method=post action=form-radiock.asp>
<input type=radio name=t1 value='road'>Road
<input type=radio name=t1 value='rail'>Rail
<input type=radio name=t1 value='air'>Air
<input type=radio name=t1 value='ship'>Ship
<input type=submit value='Submit'>
</form>


As we submit the form the value of the selected radio button will be available at the action page and we can collect the value of this radio button like this.

Dim mode
mode=Request("t1")
Response.Write " Mode of Transport is " & mode


This way the selected mode of transport will be available for further processing.

Further readings
Form Get method to collect data in ASP script
Form Post method to collect data
Difference between GET and Post method of form submission
Different ways of passing variables with data between pages
Form handling in ASP
Collecting checked radio button value of a HTML form in ASP
Collecting checkbox button value of a HTML form in ASP
 
Scripts
PHP
JavaScript
All ASP Tutorials
Popular Tutorials
Managing two drop downs
ASP Tutorials
Date and time
Declaring array
Form in ASP
Server.MapPath
Date Time & MSSQL
Select Query
File System Object
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.