Tuesday, 15 February 2011

php echo in form is not working -



php echo in form is not working -

my code doesnt seem work.. radio buttons appear nil beside them .. seems if mysql_fetch_row not working reason have played code , replaced $qnumber value manually , tested nil appeared. please advise wrong? cheers ps. new @ this.

this code.

<?php include 'dbyear2.php'; $qnumber = ($_request['uqn']); // obtain question number url $find = mysqli_query($condbyear2, "select * renal uqn='$qnumber'"); while($retrieve=mysqli_fetch_row($find)); { $question = $retrieve['question']; $a = $retrieve['mcq_a']; $b = $retrieve['mcq_b']; $c = $retrieve['mcq_c']; $d = $retrieve['mcq_d']; $e = $retrieve['mcq_e']; $answer = $retrieve['answer']; $correct = $retrieve['mcq_correct']; } ?> <form action='check.php' method='post'> <table> <tr><td></td><td></td></tr> <tr></tr> <tr><td><input type='radio' name='group1' value='a' /></td><td> <?php echo $a; ?></td></tr> <tr><td><input type='radio' name='group1' value='b' /></td><td> <?php echo $b; ?></td></tr> <tr><td><input type='radio' name='group1' value='c' /></td><td> <?php echo $c; ?></td></tr> <tr><td><input type='radio' name='group1' value='d' /></td><td> <?php echo $d; ?></td></tr> <tr><td><input type='radio' name='group1' value='e' /></td><td> <?php echo $e; ?></td></tr> <tr> <?php // sending retrieved info mysql via post utilize in check.php file $qnumber; $a; $b; $c; $d; $e; $answer; $correct; ?></tr> <tr><td><input type="submit" value="submit"></td></tr> </table> </form>

1) remove ; @ end of while statement

2) mysqli_fetch_row returns enumerated array. require associative array should utilize mysql_fetch_assoc or mysqli_fetch_array instead.

while($retrieve=mysqli_fetch_assoc($find)) { ....

php forms mysqli echo

No comments:

Post a Comment