burge124 Posted February 27, 2008 Share Posted February 27, 2008 its prob blatant but ive been sat infront of it for so long cant see it. it was working fine 5mins ago! <?php $con = mysql_connect("localhost","root","") or die('Could not connect: ' . mysql_error()); mysql_select_db("questiondb", $con); $result = mysql_query("SELECT * FROM question WHERE ChapterID='1'"); $user= mysql_fetch_array($result); ?> <form name="form1" method="post" action="index.php"> <lable> <table width="342" border="1"> <tr> <th width="92" scope="col">ChapterTitle</th> <th colspan="2" scope="col"> </th> </tr> <tr> <th scope="row">Question:</th> <td colspan="2"><?php echo $user['QuestionTitle']; ?> <label></label></td> </tr> <tr> <th scope="row">Answer A:</th> <td width="193"><?php echo $user['AnswerA']; ?></td> <td width="35"><input name="question1" type="radio" value="A"></td> </tr> <tr> <th scope="row">Answer B:</th> <td><?php echo $user['AnswerB']; ?></td> <td><input name="question1" type="radio" value="B"></td> </tr> <tr> <th scope="row">Answer C:</th> <td><?php echo $user['AnswerC']; ?></td> <td><input name="question1" type="radio" value="C"></td> </tr> </table> <p> <? $question1 = $_POST['question1']; ?> <? if ($question1 == $user['CorrectAnswer']) { echo ("<b>Correct</b>"); } else { echo ("<b>Incorrect</b>"); } ?> </p> <p> <label> <input type="submit" name="Submit" value="Submit"> </label> <input type="reset" name="Submit2" value="Reset"> </p> </form> Quote Link to comment Share on other sites More sharing options...
burge124 Posted February 27, 2008 Author Share Posted February 27, 2008 it prints this... Correct"); } else { echo ("Incorrect"); } ?> Quote Link to comment Share on other sites More sharing options...
burge124 Posted February 28, 2008 Author Share Posted February 28, 2008 any suggestions? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 28, 2008 Share Posted February 28, 2008 <?php if ($question1 = $user['CorrectAnswer']) { echo ("<b>Correct</b>"); } else { echo ("<b>Incorrect</b>"); } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.