#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    7
    Rep Power
    0
    Hi ,
    I try to display the multiple checkbox in my form and the quantity of this are depends on how many records in my database (usually the record is more than 500). So how big space it takes to display. And to solve the spaces problem, i thing i better display with horizontal scrollbar to save the space. But i don't know to do it.

    If anybody have any idea please reply me.

    Thanks.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Annapolis, Maryland US
    Posts
    113
    Rep Power
    15
    Try something like the following....you can change the value of $numcols to any number of horizontal columns in the table - if you do, just change the middle else if statement in the while loop to accommodate the possible values.

    <?

    $numcols=4;

    print"<form method=POST action="foo">";
    print"<table>";

    $query="SELECT something from mytable order by something";
    $result=mysql_query($query, $link);
    $count=0;
    while($row=mysql_fetch_row($result))
    {
    if($count%$numcols==0)
    print"<tr><td><input type="checkbox" name="name[]" value="$row[0]">$row[0]</td>"
    ;
    else if(($count%$numcols==1) &#0124; &#0124; ($count%$numcols==2))
    print"<td><input type="checkbox" name="name[]" value="$row[0]">$row[0]</td>";

    else
    print"<td><input type="checkbox" name="name[]" value="$row[0]">$row[0]</td></tr>
    ";
    $count++;
    }
    mysql_free_result($result);
    print"</table>";
    print"<input type="submit" value=" go ">";
    print"</form>";
    ?>
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    7
    Rep Power
    0
    Hi Kyuzo, thanks for you reply.

    Your idea is good but in this case, i actually already displayed my checkbox in horizontal columns/rows and its take to many spaces on that. so that form looks too height. in this form, not only checkbox for checking cause beside that others category also have likes filename,accessible group and user, comments etc.
    If anybody have any idea please reply me.

    Thanks.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    In answer to your question, you're plan is wrong I think.

    Why are you trying to pull 500 records from a table at once, instead limit (to say 50)the amount and display on separate pages.

    People aren't used to scrolling horizontally.

    Jason

Similar Threads

  1. Replies: 5
    Last Post: February 2nd, 2005, 12:28 AM
  2. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 02:21 PM
  3. Urgent problem!
    By Vanessa Wi. in forum Java Help
    Replies: 0
    Last Post: February 6th, 2004, 07:10 AM
  4. checkbox submit problem
    By an_gel111 in forum PHP Development
    Replies: 0
    Last Post: January 30th, 2004, 04:21 AM
  5. weird java problem..please help
    By suwandy in forum Java Help
    Replies: 1
    Last Post: January 26th, 2004, 04:13 AM

IMN logo majestic logo threadwatch logo seochat tools logo