Jump to content

cant create table row with counter


Lassie

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/231405-cant-create-table-row-with-counter/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.