Radio buttons are appropriate when the visitor should choose exactly one value from a group. Give every radio button in the group the same name and a different value.
<form method="post" action="radio-check.asp">
<label><input type="radio" name="choice" value="yes"> Yes</label>
<label><input type="radio" name="choice" value="no"> No</label>
<button type="submit">Submit</button>
</form>
The receiving ASP page can read the selected value directly:
Dim choice
choice = Request.Form("choice")
Response.Write Server.HTMLEncode(choice)
If no radio button is selected, the submitted value can be empty. Validate the result against the values your application allows instead of trusting arbitrary request text.
Dim choice
choice = Request.Form("plan")
Select Case choice
Case "basic", "plus"
Response.Write Server.HTMLEncode(choice)
Case Else
Response.Write "Choose a valid plan."
End SelectA visitor can change submitted form values. An allowlist protects the server-side workflow from unexpected options.
The browser can omit a radio value or submit a modified value. Check the value against an allowlist on the server before using it.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.