Hey Guys.
Can anyone see why this short script isn't working. Its a basic bit of programming to record a users answers in a multiple choice quiz. Each answer should be stored in the same array which should be passed through the 10 questions. I have written a check to see if the answers have been added to the array but the only thing that seems to be in the array is the username (posted from a previous page). Anyway any help or tips would be greatfully recieved. :)
Cheers.
Whoops i nearly forgot the code....
<?php
$qid = $_POST[qNum];
$name = $_POST[tutname];
$My_Array[0] = $name;
require_once('db_login.php');
$query="select * from question where Q_id = \"$qid\"";
$result = $db->query($query);
if (DB::isError($result)) die($result->getMessage());
$count = $qid + 1;
if ($row = $result->fetchRow())
{
if (DB::isError($row)) die($result->getMessage());
foreach($My_Array as $value)
{
echo "$value\n";
}
echo "<center><img src = \"$row[6]\"></center><br />";
echo "<center>$row[1]</center>";
echo "
<center>
<form action=\"$PHP_SELF\" name=\"Q1\" method=\"post\">
<input type=\"radio\" name=\"question\" value=\"1\">$row[2]<br />
<input type=\"radio\" name=\"question\" value=\"2\">$row[3]<br />
<input type=\"radio\" name=\"question\" value=\"3\">$row[4]<br />
<input type=\"radio\" name=\"question\" value=\"4\">$row[5]<br />
<br />
<input type=\"hidden\" name=\"qNum\" value=\"$count\">
<input type=\"hidden\" name=\"tutname\" value=\"$name\">
<input type=\"submit\" value=\"Next\" />
</form></center>";
$My_Array[] = $question;
}
?>
Cheers.