Unable to verify answer
<p>I have a form having text field. When user submit data it checks whether the entered data is correct or not against a column "Answer" in a table.</p>

<p>But here is the problem - it is accepting anything without verifying the submitted text field against the correct answer. </p>

<p>I am new to php so please help. here is the code.</p>

<pre><code> $myuser = $_SESSION["myusername"]; $mypass = $_SESSION["mypassword"];
 $host="localhost"; // Host name 
 $username="f123"; // Mysql username
 $password="t"; // Mysql password 
 $db_name="f"; // Database name 
 $tbl_name="members"; // Table name 
 $tbl_name2="quiz"; // Table name 2


mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

if(isset($_POST['qno']))
{
$sql3="SELECT * FROM $tbl_name2 WHERE id='".$_POST['qno']."'";
$result3=mysql_query($sql3);

$disp3=mysql_fetch_assoc($result3);

$sql4="SELECT * FROM $tbl_name WHERE username='$myuser' and password='$mypass'";
$result4=mysql_query($sql4);

$disp4=mysql_fetch_assoc($result4);

if($disp3['Answer']==$_POST['Answer'])
{

$sql5="UPDATE $tbl_name SET level_crossed='".($disp4['level_crossed']+1)."',
Score='".($disp4 ['Score']+1)."' WHERE username='$myuser' and password='$mypass'";
 $result5=mysql_query($sql5);
}
else {
$sql5="UPDATE $tbl_name SET level_crossed='".($disp4['level_crossed']+1)."' 
WHERE    username='$myuser' and password='$mypass'";
$result5=mysql_query($sql5);

&lt;form name="quizq" action="quiz.php" method="post" &gt;
&lt;input name="qno" type="hidden" value="&lt;?php echo $disp['level_crossed']+1; ?&gt;" /&gt;
&lt;input type="text"  name="Answer"  /&gt;
&lt;input type="submit" value="Submit Answer" /&gt;&lt;/p&gt;
&lt;/form&gt;
</code></pre>
