ifis Posted January 24, 2008 Share Posted January 24, 2008 i have a while statement in my code so I can output an array of variable lenght. The only problem is that the page does not display in the correct order, I.E. my footer comes before the output of the while statement, any way to fix this. Here is the php code: sql = "SELECT * FROM `writtenqs` ORDER BY RAND() LIMIT 3"; $result=mysql_query($sql); echo "<form id='form1' name='form1' method='post' action='insttest2.php'> <table width='100%' border='1'>"; $i=1; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td width='13%' scope='row'>$row[code]</td>"; echo "<td width='87%'>$row[lic] </td>"; echo " </tr>"; echo "<tr>"; echo "<td></td>"; echo "<td>$row[question]</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope='row'> </th> <td> <p> <label> <input type='radio' name='answer'.$i value='A' id='RadioGroup1_0' />$row[oneanswer]</label> <br /> <label> <input type='radio' name='answer'.$i value='B' id='RadioGroup1_1' /> $row[twoanswer]</label> <br /> <label> <input type='radio' name='answer'.$i value='C' id='RadioGroup1_2' /> $row[threeanswer]</label> <br /> <input name='question#'.$1.' type='hidden' value='$row[numquestion]' /> </p> </td> </tr>"; $i++; } echo "<input name='Submit' type='button' value='Submit' /> </form>"; ?> Thanks[/code] Quote Link to comment https://forums.phpfreaks.com/topic/87474-solved-problem-with-while-statement/ Share on other sites More sharing options...
ifis Posted January 24, 2008 Author Share Posted January 24, 2008 It's been a long day. I was missing a </table> and that messed it all up! Quote Link to comment https://forums.phpfreaks.com/topic/87474-solved-problem-with-while-statement/#findComment-447413 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.