Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP (VBscript) radio buttons not returning value

I have 2 very simple pages, an HTML page and a classic ASP page .. the html page has a form which calls (and sends) the data to the ASP form (which then prints out the data)

The problem is I'm not getting the value of the radio button, I'm simply just getting "on".

Here is the html:

<form action="form.asp" method="post">
    <strong>Gender:</strong>
    <input type="radio" value"male" name="gender">Man
    <input type="radio" value"female" name="gender">Woman<p></p>
    <strong>Size:</strong>
    <input type="text" width="20" name="size" size="4"><p></p>
    <strong>Color:</strong>
    <select size="1" name="color">
        <option>blue</option>
        <option>green</option>
        <option>black</option>
    </select><p></p>
    <input type="submit" value="Send Order">
</form>

and here is the ASP

<%
Dim strgen, strsize, strcol
strgen = Request.form("gender")
intsize = Request.form("size")
strcol = Request.form("color")
Response.write "Your gender: " & strgen & "<br />"
Response.write "Your size: " & intsize & "<br />"
Response.write "The color you ordered: " & strcol & "<br />"

%>

Like I said, all I'm getting for "strgen" is "on" ...

like image 926
Kevin Avatar asked Jul 09 '26 05:07

Kevin


1 Answers

There's typos in your code, missing equals sign.

value"male"

should be

value="male"

Because the value was ignored it was returning the default value of "on"

like image 150
AUSteve Avatar answered Jul 11 '26 19:07

AUSteve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!