klinmy Posted April 8, 2006 Share Posted April 8, 2006 radio.php[code]<form method="post" action="nextpage.php"><? $query=mysql_query("SELECT name FROM staff WHERE id='1122' ");while ($row = mysql_fetch_array($query)){ echo "$row[name]"; $name=$row[name]; } ?><input type="radio" name="answer" value="<? $_POST['name'] ?>"><input type="radio" name="answer" value="B"><input type="submit" name="Submit" value="Submit"></form>[/code]nextpage.php[code]<? echo '1122 is '.$_POST['name']!; ?>[/code]when i clicked in the 1st radio button, it displayed "[!--coloro:#3333FF--][span style=\"color:#3333FF\"][!--/coloro--]1122 is ! [!--colorc--][/span][!--/colorc--]" why cant it display the name as it's shown in radio.php? thanks Quote Link to comment Share on other sites More sharing options...
khendar Posted April 8, 2006 Share Posted April 8, 2006 Ok....You are passing the value of $_POST['name'] as the value of the first radio button, but this radio button is not called name its called answer.In nextpage.php you should echo $_POST['answer']; not $_POST['name'];Also, you shouldn't use the ! symbol where it is. When ! is not inside a string it becomes a the logical operator NOT. If you want the ! to be printed out at the end of the string you should put it inside single quotes and use the . symbol to add it to the line being echoed. Quote Link to comment Share on other sites More sharing options...
klinmy Posted April 8, 2006 Author Share Posted April 8, 2006 thanks khendar, i've change the name to answer as u taught, and canceled off the '!', but it's still the same.. Quote Link to comment Share on other sites More sharing options...
khendar Posted April 8, 2006 Share Posted April 8, 2006 Check out the html source code of your form. See if the value is being assigned to the radio button in the first place. If not it means the error is somewhere else.I take it you want to set the value to the name from the database ?Then you should change it to:[code]<input type="radio" name="answer" value="<? echo $name; ?>">[/code] Quote Link to comment Share on other sites More sharing options...
klinmy Posted April 8, 2006 Author Share Posted April 8, 2006 yea thanks alot khendar! it works now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.