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 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2012
    Posts
    38
    Thanks
    8
    Thanked 1 Time in 1 Post

    Capturing checkbox value of a string and moving to another table.

    I have a table of names with a checkbox in each row.

    http://webdesign4.georgianc.on.ca/~1.../wi/guests.php

    I want to to be able to check multiple boxes and move them to an identical table called 'confirmed'.

    Here is my table php

    PHP Code:
                /*open db connection*/
                
    $conn mysqli_connect('localhost''db100116763''15943''db100116763') or die('Error connecting to MySQL server.');
                
                    
    /*retrieve all properties*/
                  
    $sql "SELECT * FROM guests";
                  
    $result mysqli_query($conn$sql) or die('Error querying database.');
                
                    echo 
    '<form><table border="1"><tr><td>ID</td><td>First Name</td><td>Last Name</td><td>Email Address</td><td>Select</td></tr>';
                    
                    
    //loop through properties and output them to an html table
                      
    while ($row mysqli_fetch_array($result)) {
                        echo 
    '<tr><td>' $row['id'] . '</td>
                                <td>' 
    $row['first_name'] . '</td>
                                <td>' 
    $row['last_name'] . '</td>
                                <td>' 
    $row['email'] . '</td> ';
                                
                        echo 
    '<td><input type="checkbox" name="mychk[]"></input></td>';
                      } 
                    echo 
    '</table></form>';
                    
                    echo 
    '<a href="delete.php?id=' $row['id'] . '">Move</a>';
                    
                  
    mysqli_close($conn); 

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,631
    Thanks
    4
    Thanked 147 Times in 138 Posts
    Why move them to another table at all? Why not merely have a Confirmed column in the one table?

  • #3
    New Coder
    Join Date
    Aug 2012
    Posts
    38
    Thanks
    8
    Thanked 1 Time in 1 Post
    Ok. So could I capture the line then output the first and last name in another column? It's for a guest list so I want people to be able to confirm their name and get put into a list of confirmed names.

    I think I hav the proper SQL Query so that part isn't a problem. I don't know how to capture multiple lines with the use of checkboxes.
    Last edited by Vigilante23; 09-12-2012 at 08:10 PM.

  • #4
    New Coder
    Join Date
    Aug 2012
    Posts
    38
    Thanks
    8
    Thanked 1 Time in 1 Post
    A good example of what I'm trying to accomplish is a basic email inbox. You can select multiple check boxes and proceed to delete them or move them to another folder. A folder displayed on a separate page.


  •  

    Posting Permissions

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