xProteuSx Posted April 22, 2008 Share Posted April 22, 2008 I hope I can make someone understand what the problem is ... its 1 am and I am crashing hard. The whole problem is that this snippet really does not like the <ol type="a"> outside of the 'while' loop. What I am trying to do is, say the array has 4 variables, I would like a., b., c., and d., to appear to the left of the <input type="radio" name="answer" value="' . $value . '"> button(s). Now, I am getting something there, but I am getting 0., 0., 0., and 0. instead of the letters. Please help!!!! Thanks in advance. echo '<center>'; echo '<form action="mark_spec.php">'; echo '<ol type="a">'; while (list($key,$value) = each($answers_array)) { echo '<table width="400" cellspacing="0" cellpadding="2">'; echo '<tr>'; echo '<td valign="top">'; echo '<li>'; echo '<font size="-1"> <input type="radio" name="answer" value="' . $value . '"></font>'; echo '</td>'; echo '<td valign="top">'; echo '<font size="-1">' . $value . '</font>'; echo '</li>'; echo '</td>'; echo '</tr>'; echo '</table>'; } echo '</ol>'; echo '<input type="submit" value="Check Answer">'; echo '</form>'; echo '</center>'; Quote Link to comment https://forums.phpfreaks.com/topic/102292-alignment-issue/ Share on other sites More sharing options...
ToonMariner Posted April 22, 2008 Share Posted April 22, 2008 that is because type is a deprecated attribute of the ol tag - just give it a class or an id to style it instead. ol should contain li elements NOT TABLES - TABLES ARE FOR TABULAR DATA. on a slightly different point - don't scared of breaking out of php - it can really help you see things better AND improve efficiency... Now - I don't like you html but that is another matter but you code could be written like so <center> <form action="mark_spec.php"> <ol type="a"> <?php while (list($key,$value) = each($answers_array)) { ?> <table width="400" cellspacing="0" cellpadding="2"> <tr> <td valign="top"> <li> <font size="-1"> <input type="radio" name="answer" value="' . $value . '"></font>'; </td> <td valign="top"> <font size="-1"><?php echo $value; ?></font> </li> </td> </tr> </table> <?php } ?> </ol> <input type="submit" value="Check Answer"> </form> </center> Now please go an produce some html that actually means something - I can see wat you are trying to do - suffice to say you are not going the right way about it - have a go at producing VALID and MEANINGFUL markup and then we might be able to help you a little more... Quote Link to comment https://forums.phpfreaks.com/topic/102292-alignment-issue/#findComment-523784 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.