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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tick Checkbox & Display Selected Records

    Hello,
    I have queried a MySQL database & displayed the results on a page. These results have checkboxes next to each record just like Yahoo Mail. The code is below & is working fine.

    Now, the next thing I want to do is to tick a few checkboxes and display only the ticked records on a new page for printing purposes. How do I do this?

    Thanks.
    PHP Code:
    <form name="form1" method="POST" action=""> 
    <?php 
    //connect to the database here 

    $result mysql_query("SELECT username FROM users WHERE user_posts = 0 
    AND username != 'Anonymous' AND user_regdate < $four_months"
    ); 

    while (
    $row mysql_fetch_array($result)) 
            { 
    echo 
    "<input type='checkbox' name='boxes[]' value='{$row 
    ['user_id']}'>" 
    "&nbsp;" $row['username']; 
    echo 
    "<br>"
            } 
    ?> 
    </form>

  • #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
    Code:
    <input type='checkbox' name='boxes[]' value='{$row['user_id']}'>
    user_id is not selected in the query.
    Code:
    <input type="checkbox" checked>
    will do the trick!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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