Thread: form php mysql
View Single Post
 
Old January 8th, 2006, 12:43 AM
Mantis Mantis is offline
Friend of Wrox
 
Join Date: Dec 2004
Location: London, London, United Kingdom.
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

print "A - $Pregunta[Resp_1] <input type='radio' name='r'><br/>\n";
print "B - $Pregunta[Resp_2] <input type='radio' name='r'><br/>\n";
print "C - $Pregunta[Resp_3] <input type='radio' name='r'><br/>\n";
print "D - $Pregunta[Resp_4] <input type='radio' name='r'><br/>\n";

->

?>
<p><input type="radio" value="<?php echo $Pregunta[Resp_1]; ?>" checked name="r">[<?php echo "A.".$Pregunta[Resp_1]; ?>]</p>
<p><input type="radio" value="<?php echo $Pregunta[Resp_2]; ?>" name="r">[<?php echo "B.".$Pregunta[Resp_2]; ?>]</p>
<p><input type="radio" value="<?php echo $Pregunta[Resp_3]; ?>" name="r">[<?php echo "C.".$Pregunta[Resp_3]; ?>]</p>
<p><input type="radio" value="<?php echo $Pregunta[Resp_4]; ?>" name="r">[<?php echo "D.".$Pregunta[Resp_4]; ?>]</p>


The Radio control use value="xyz" to difference itself.. you forgot it in your code. easy fix.
$Pregunta_Selection = $_POST['r'];
Hope this help.