views:

16

answers:

1

I have written a small HTML form and added it to the page. My goal is for it to POST the value of the Checked button to a PHP page which I have also written. The PHP page is not getting the value for some reason. I am also not getting any PHP errors. The codes are below.


form.php

<form action="http://www.zbrowntechnology.com/InsaneBrain/quiz.php" method="POST">
<font color="white" size="3">
<?php
$con = mysql_connect("HOST", "USER", "PASS");
if(!$con) {
  die('Unable to connect to MySQL:   '.mysql_error());
}
mysql_select_db("zach_insaneB", $con);
$result = mysql_query("SELECT Name FROM quiz"); 
while($row = mysql_fetch_assoc($result)) {
 $qname = $row['Name'];
 echo "<input type='radio' name='button1' id='$qname'>";
 echo "<label for='$qname'><font color='white'/>$qname</font></label>";
}
?>
</font>
</div>
</div>

<div id="Oobj12">
<div id="Gcode234" class="dfltc">
<input type="image" src="http://www.zbrowntechnology.com/InsaneBrain/begin.png" alt="Begin" />
</form></div>
</div>

getdata.php

<?php
$data = $_POST['button1'];
echo $data;
?>
+3  A: 

Actually, I see the problem...you don't actually have a value in the radio button. You need something like:

echo "<input type='radio' name='button1' id='$qname' value='$some_value'>";
d2burke