PHP radio buttons problem

Hi all,

I have a problem with this script whereby when the continue button is pressed the page visually scans through the radio buttons options and rests on the last option always before going onto the next screen. This can be confusing for users if they selected option a and it looks like they have selected option c.

See this page for visual :

http://www.whatyouseeyoucannotbe.com/inves/freewill/tester.php

I know the php code at the top checks to see what option is selected and sends the user to the appropiate page but I don't want the user to see this scan visually.

Thanks,

D
<?php 
if(isset($_POST['go'])){
$pagetogo = $_POST['radio'];
if($pagetogo == 1){
header("Location: fwq.php");
exit;
}
if($pagetogo == 2){
header("Location: page2.php");
exit;
}
if($pagetogo == 3){
header("Location: fwz.php");
exit;
}
}
?>
 
<form id="form1" name="form1" method="post" action="">
  <label>
  <input type="radio" name="radio" id="radio" value="1" />
  </label> 
  Yes <br />
  <label>
  <input type="radio" name="radio" id="radio2" value="2" />
  </label>
  Some<br />
  <label> 
  <input name="radio" type="radio" id="radio3" value="3">
   No,<br>
  <br>
  <br>
  <input type="submit" name="go" id="submit" value="Continue" />
</label>
</form>

Open in new window

jones_bonesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
>>the page visually scans through the radio buttons options and rests on the last option always
You will be happy to know that I don't see this behaviour on IE6 WinXP. Must be a browser issue. What I see is that whatever I clicked remains clicked until redirected.
BTW: Choosing Maybe takes me to  page not found
0
jones_bonesAuthor Commented:
Okay thanks,

Yup I only set that one up as a test page. Yes, I've checked it now in IE alright and it works fine just not in FF. Same old story I guess :) Don't know, is there much I can do about it or can anyone think of a different way to arrange the code so that this problem does not occur?

Thanks,

D
0
shiraztiCommented:
Try this one.. Works fine with Both IE and FF 2.0

Please use the label tag properly... ;-)
<form id="form1" name="form1" method="post" action="">
     <input type="radio" name="radio" id="radio1" value="1" />
    		<label for="radio1">Yes</label>   
    		<br />
     <input type="radio" name="radio" id="radio2" value="2" />
    		<label for="radio2">Some</label>
     		<br />
      <input name="radio" type="radio" id="radio3" value="3">
       		<label for="radio3"> No</label>,<br>
      		<br>
      		<br>
      <input type="submit" name="go" id="submit" value="Continue"  />
 
</form>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jones_bonesAuthor Commented:
Excellent! Thanks for spotting that!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.