qiang8
asked on
How to check HTML parameter in VBscript ?
My code:
...
<TR><TD>
<input type='radio' name='ans' value='yes' >
<input type='radio' name='ans' value='no' >
</TD></TR>
How to write the following codes to check whether which of the above is checked and then proceed accordingly.
<%
if (ans=yes) ;How check here??
Do this
else
Do that
%>
...
<TR><TD>
<input type='radio' name='ans' value='yes' >
<input type='radio' name='ans' value='no' >
</TD></TR>
How to write the following codes to check whether which of the above is checked and then proceed accordingly.
<%
if (ans=yes) ;How check here??
Do this
else
Do that
%>
ASKER
I have tried the following but wrong ans
given.
<input type='radio' name='ans' value='yes' checked >
<input type='radio' name='ans' value='no' >
<%
if( Request.form("ans") = "yes" )then
Response.Write "Yes"
else if ( Request.form("ans") = "no" )then
Response.Write "No"
else
Response.Write "No answer"
end if
end if
%>
The ans is always "No answer". Why?
given.
<input type='radio' name='ans' value='yes' checked >
<input type='radio' name='ans' value='no' >
<%
if( Request.form("ans") = "yes" )then
Response.Write "Yes"
else if ( Request.form("ans") = "no" )then
Response.Write "No"
else
Response.Write "No answer"
end if
end if
%>
The ans is always "No answer". Why?
why you not put different name of radio button
ASKER
I can't put different names to the radio buttons as I want ONLY one of them to be selected. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please let me know if you got this to work because if not, you are doing something wrong that I, perhaps, can help you with.
ASKER
Thank yo very much for ur help. It works!
So use the value attribute.)
Use the form collection.
I thing it's something like this :
Request.form("ans") = "yes"