Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problem positioning..

    database structure


    it should display this



    PHP Code:
    <?php
    echo'<form method="post" name="myform" 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...
    Last edited by absolut; 05-11-2008 at 04:54 AM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    How about changing your echo like
    Code:
    echo "<td><input type='checkbox' name='sa[]' value='$row[cid]'></td>";
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    How about changing your echo like
    Code:
    echo "<td><input type='checkbox' name='sa[]' value='$row[cid]'></td>";
    the output:
    cost cost checkbox checkbox
    cost cost checkbox checkbox
    cost cost checkbox checkbox

    I want to appear the checkbox beside with each cost
    cost checkbox cost checkbox
    cost checkbox cost checkbox
    cost checkbox cost checkbox


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •