My if statement doesn't recognize the textbox name ("ans"). What should I change? and where should I put it? I also want to know if my if statement is correct; I want to compare the value inside the database with the input value ("ans"). Thanks in advance.
<?php
$con = mysql_connect("localhost", "root", "avtt123");
mysql_select_db("arvintarrega",$con);
$sql = "SELECT * from identification";
$myData = mysql_query($sql,$con);
echo '<form method = "POST">';
while($iden = mysql_fetch_array($myData))
{
echo '<center>' . $iden['question_number'] . '. ' . $iden['statement'] . ' <input type = "text" name = "ans"></input></center></br>';
if($iden['correct_answer'] == $_REQUEST['ans'])
{
echo "Correct";
}
else
{
echo "Wrong";
}
}
echo '</form>';
?>
<form method = "POST">
<input type = "submit" name = "submit" value = "Submit" class="btn btn-warning">
</form>

<?php error_reporting(E_ALL); ini_set('display_errors', 1);then the rest of your code, to see if it yields anything. Also addor die(mysql_error())tomysql_query(). Also useisset()inside and in conjunction withif($iden['correct_answer'] == $_REQUEST['ans']). You also don't have a submit button.while($iden = mysql_fetch_array($myData))<===