darylesha Posted August 1, 2007 Share Posted August 1, 2007 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: 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 Quote Link to comment https://forums.phpfreaks.com/topic/62865-insert-and-delete-with-multiple-checkboxes/ Share on other sites More sharing options...
almightyegg Posted August 1, 2007 Share Posted August 1, 2007 on the page it is sent to you would put something like this - <? $checkbox = $_POST['checkbox']; if($checkbox == TRUE){ // do the delete }else{ // do nothing } ?> Now I think that will work... Quote Link to comment https://forums.phpfreaks.com/topic/62865-insert-and-delete-with-multiple-checkboxes/#findComment-312935 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.