Insert and DELETE with Multiple Checkboxes
Posted: Wed Aug 01, 2007 10:51 am
Hello, I currently have a page with a repeated region that has information from a table with a checkbox proceed each line.
My objective is for the admin (on the frontend) to be able to check multiple boxes and when they press the submit button, the information that is stored in the database should be copied to a new database and deleted from the existing database.
What I currently have is this:
[/i]
I am not sure how to check whether the checkbox is checked and then where to insert the code (before or after the submit button). I have a basic algorithm but I have no ide how to implement it in PHP. I also know what the SQL statement would be. I have searched and read plenty of books but I just don't know how to put the info together.
Any help would be greatly appreciated
My objective is for the admin (on the frontend) to be able to check multiple boxes and when they press the submit button, the information that is stored in the database should be copied to a new database and deleted from the existing database.
What I currently have is this:
Code: Select all
mysql_select_db ($database, $Trial);
$query = "SELECT * FROM contactinfo";
$Record = mysql_query($query, $Trial) or die(mysql_error());
$row = mysql_fetch_assoc($Record);
totalrows = mysql_num_rows($Record);
<form id= "form" name="form" method="post" action="">
<?php do { ?>
<input type = "checkbox" name= "checkbox" id= "checkbox" />
<?php echo $row['ID']; ?>, <?php echo $row['FNAME'], ?>
<?php echo $row['address']; ?>
<?php } while ($row = mysql_fetch_assoc($Record) ?>
<input type="submit" name="button" id="button" value="submit"/>I am not sure how to check whether the checkbox is checked and then where to insert the code (before or after the submit button). I have a basic algorithm but I have no ide how to implement it in PHP. I also know what the SQL statement would be. I have searched and read plenty of books but I just don't know how to put the info together.
Any help would be greatly appreciated