Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with radio buttons and php 1

Status
Not open for further replies.

natefanaro

Technical User
Jun 10, 2002
17
US
I am creating a site for online quizes and having a problem with creating a quiz out of php. When you usually deal with radio buttons, when you change your mind on a choice it will remove the previous selection. when you use the html below, it will allow you to select every darn radio button there. I figured out that it has something to do with the fact that I have a variable after each radio button. when I remove the variable, it works! here's the code that I am using.

<INPUT type=radio name=&quot;result1&quot; value=&quot;1&quot;><? echo $ans1 ?>
<INPUT type=radio name=&quot;result2&quot; value=&quot;1&quot;><? echo $ans2 ?>
<INPUT type=radio name=&quot;result3&quot; value=&quot;1&quot;><? echo $ans3 ?>

any ideas
 
For a set of radio buttons to &quot;group&quot; into a unit which will clear all other choices then one choice is selected, all the radio buttons in that group must have exactly the same name.

Try

<INPUT type=radio name=&quot;question1&quot; value=&quot;1&quot;><? echo $ans1 ?>
<INPUT type=radio name=&quot;question1&quot; value=&quot;1&quot;><? echo $ans2 ?>
<INPUT type=radio name=&quot;question1&quot; value=&quot;1&quot;><? echo $ans3 ?> ______________________________________________________________________
TANSTAAFL!
 
darn, that worked but that screws up what I was doing kind of. I used result1=1 in the next page where it took that number and added it to another variable. eh, I'll think of something. thanks though!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top