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> Link to comment https://forums.phpfreaks.com/topic/93417-if-else-statment-was-working-5mins-ago-cant-see-error/ 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"); } ?> Link to comment https://forums.phpfreaks.com/topic/93417-if-else-statment-was-working-5mins-ago-cant-see-error/#findComment-478595 Share on other sites More sharing options...
burge124 Posted February 28, 2008 Author Share Posted February 28, 2008 any suggestions? Link to comment https://forums.phpfreaks.com/topic/93417-if-else-statment-was-working-5mins-ago-cant-see-error/#findComment-478630 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>"); } ?> Link to comment https://forums.phpfreaks.com/topic/93417-if-else-statment-was-working-5mins-ago-cant-see-error/#findComment-478631 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.