can somebody help me in dealing with this project...
I am making a quiz that a user can input their own set of questions..after doing a quiz other users can take it..and I don't know how to check if the user answers were right..
can you please help me? thanks!

Here's my code in getting the users answer to questions..

<html>
<head>

</head>
		
	<body>
	<form id="form1" name="form1" method="post" action="engquiz4.php">
  <table width="500" border="0">
    <tr>
      <td colspan="500"><b>Multiple Choice</b></td>
    </tr>
    <tr>
      <td colspan="500"><b>Choose the correct answer and press the "submit" when done.</b></td>
    </tr>
</table>
<?php
$connect = mysql_connect("localhost","garry","perez")or die("can't access database");
mysql_select_db("phplogin") or die("can't access database");

$SQL="SELECT* FROM engquiz WHERE quiznum=1";
$result=mysql_query($SQL);
$group1 = "1";

	while($row=mysql_fetch_assoc($result))
		{
    	echo $group1.". ".$row['question']."<br>";
		echo "<input type= \"radio\" name =\"$group1\" value=\"q1o1\">".$row['opt1']."<br>";
		echo "<input type= \"radio\" name =\"$group1\" value=\"q1o2\">".$row['opt2']."<br>";
		echo "<input type= \"radio\" name =\"$group1\" value=\"q1o3\">".$row['opt3']."<br>";
		$group1 ++;
		
		}
	?>
<p>
    <label>
    <input type="submit" name="Submit" value="Submit" />
    </label>
  </p>
  </form>
</body>
</html>
Member Avatar for diafol

check the data from the form against the 'correct value' in your DB. If you haven't got a cluse what I'm talking about, read up on $_POST variables and MySQL statements.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.