Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-12-2012, 06:43 PM   PM User | #1
Vigilante23
New Coder

 
Join Date: Aug 2012
Posts: 29
Thanks: 5
Thanked 1 Time in 1 Post
Vigilante23 is an unknown quantity at this point
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); 
Vigilante23 is offline   Reply With Quote
Old 09-12-2012, 07:25 PM   PM User | #2
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
Why move them to another table at all? Why not merely have a Confirmed column in the one table?
guelphdad is offline   Reply With Quote
Old 09-12-2012, 08:03 PM   PM User | #3
Vigilante23
New Coder

 
Join Date: Aug 2012
Posts: 29
Thanks: 5
Thanked 1 Time in 1 Post
Vigilante23 is an unknown quantity at this point
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..
Vigilante23 is offline   Reply With Quote
Old 09-12-2012, 09:56 PM   PM User | #4
Vigilante23
New Coder

 
Join Date: Aug 2012
Posts: 29
Thanks: 5
Thanked 1 Time in 1 Post
Vigilante23 is an unknown quantity at this point
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.
Vigilante23 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:29 AM.


Advertisement
Log in to turn off these ads.