problem positioning..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
absolut
Forum Newbie
Posts: 2
Joined: Thu May 08, 2008 1:03 am

problem positioning..

Post by absolut »

database structure
Image

it should display this

Image

Code: Select all

 
<?php
echo'<form method="post" name="formn" action="file.php">';
$result = mysql_query("SELECT iqid, cost, userid FROM ctable where postid=$post");
while ($row = mysql_fetch_array($result))
{
  $arr[$row['iqid']][$row['userid']] = $row['cost'];
  $uid[] = $row['userid'];
}
$uid = array_unique($uid);
$qid = array_keys($arr);
echo '<table cellpadding=5><tr><td></td>';
foreach($uid as $userid) echo "<td>$userid</td>";
echo '</tr>';
    foreach($qid as $iqid)
    {
     echo "<tr><td>$iqid</td>";
        foreach($uid as $userid)
        {
        echo '<td>';
            if (isset($arr[$iqid][$userid])) echo $arr[$iqid][$userid];
        echo '</td>';
        }
    }
$result = mysql_query("SELECT cid FROM ctable WHERE postid=$post");
while ($row = mysql_fetch_array($result))
{
echo "<input type='checkbox' name='sa[]' value='$row[cid]'>";
}
echo "</tr>";
echo '</table>';
echo '<input type="submit" name="listing" />';
echo'</form>';  
 
?>
I've added checkbox and I need to get the cid..
I have problem in positioning, the checkbox appeared in the top of the userid(above userid)
I want the checkbox to appear beside with the cost..
please help me...
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: problem positioning..

Post by Jade »

Set width % to that td value in the table to force it to be wider. The problem is that by default the other cells are pushing that particular cell smaller. Also, you need to put the checkbox inside of <td> </td> tags, otherwise it will be floating in the tables in the wrong place. You can check to see how this effects the table making the table have borders with <table cellpadding=5 borders=1>
Post Reply