Lassie Posted March 22, 2011 Share Posted March 22, 2011 I want to show a table with a max of three columns. I am using an if statement to count the rows and then start a new row (after 3 cols), I cant see my error. The output just gice one col with all the data in it. Any help appreciated. <form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST" id="cover" enctype="multipart/form-data"> <table width="700"><?php /* display picture and radio button */ //add counter for more than 3 images $i=0; $size=3; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $coverID=$row['coverID']; echo"<tr>"; echo "<td>"; echo"<img src=\"/wordpress_3/wp-content/plugins/Authors2/jackets/{$row['pix']}\" />"; echo "<input type = 'radio' name ='cover' value= '$coverID'/>"; ?> <br /> <input type="submit" value="submit"> <?php echo"</td>"; $i++; if($i==$size) { echo "</tr><tr>"; $i=0; } } ?></table> </form><?php Quote Link to comment Share on other sites More sharing options...
Lassie Posted March 22, 2011 Author Share Posted March 22, 2011 Found the error Missed putting this in and had it within the while $i=0; $size=3; echo"<tr>"; 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.