For some reason it doesn't update my DB, but I know that it's correct because it worked before:
<HTML>
<link rel="stylesheet" href="quiz.css" type="text/css">
<body><center>
<P> </P>
<B>Admin area - edit the quiz</B>
<?php
$table = "quiz1";
$table2 = "quiz2";
/* Table fields are quiz1 - Question, QuestionID, quiz2 - Question, QuestionID, OptionID, Option, IsOptionCorrect*/
if($submit)
{
$sql = "INSERT INTO $table2 (Question, QuestionID, OptionID, Option, IsOptionCorrect) VALUES ('$Question','$QuestionID','$OptionID','$Option','$IsOptionCorrect')";
$result = mysql_query($sql);
echo "<br><br>Question added to quiz.<br><br>";
$findid = mysql_query("SELECT QuestionID FROM $table2 ORDER BY QuestionID DESC");
$myrow = mysql_fetch_array($findid);
$id = $myrow["QuestionID"];
$qsql = "UPDATE $table2 SET QuestionID='QuestionID' WHERE QuesionID=QuestionID";
$qresult = mysql_query($qsql);
}
else if($update)
{
$sql = "UPDATE $table2 SET Question='$Question',QuestionID='$QuestionID',OptionID='$OptionID',Option='$Option',IsOptionCorrect='$IsOptionCorrect'";
$result = mysql_query($sql);
echo "<br><br>The quiz has been succesfully updated.<br><br>\n";
}
else if($id)
{
$result = mysql_query("SELECT * FROM $table2 WHERE QuestionID=QuestionID",$db);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type="hidden" name="QuestionID" value="<?php echo $myrow["QuestionID"]?>">
<b>Question:</b><br>
<input type="Text" name="Question" value="<?php echo $myrow["Question"]?>" size="50">
<br>
<b>QuestionID:</b><br>
<input type="Text" name="QuestionID" value="<?php echo $myrow["QuestionID"]?>" size="30">
<br>
<b>OptionID :</b><br>
<input type="Text" name="OptionID" value="<?php echo $myrow["OptionID"]?>" size="30">
<br>
<b>Option :</b><br>
<input type="Text" name="Option" value="<?php echo $myrow["Option"]?>" size="30">
<br>
<b>IsOptionCorrect:</b><br>
<input type="Text" name="IsOptionCorrect" value="<?php echo $myrow["IsOptionCorrect"]?>" size="30">
<br>
<br>
<input type="Submit" name="update" value="Update information"></form>
<?
}
else
{
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<p><br>
<b>Question:</b><br>
<input type="Text" name="Question" size="50">
<br>
<b>Question ID:</b><br>
<input type="Text" name="QuestionID" size="30">
<br>
<b>Option ID:</b><br>
<input type="Text" name="OptionID" size="30">
<br>
<b>Option :</b><br>
<input type="Text" name="Option" size="30">
<br>
<b>Is Option Correct:</b><br>
<input type="Text" name="OptionIsCorrect" size="30">
<br>
<br>
<input type="Submit" name="submit" value="Enter information">
</p>
</form>
<?
}
?>
<a href="driver.php?x=editquizlist">Back to list of quiz questions</a>
</center>
</body>
</HTML>