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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.