I've got this page in which people can input their suggestions, and the information is stored on my server. To deal with these suggestions, I created a page (with the help of my friend Bill) which allows me to delete/edit suggestions. However, currently, the page will only delete one suggestion at a time.. but I'd like it to be able to delete all of the suggestions that are checked. Here's the code for the admin actions
$row_del = (isset($_POST['sub_del'])) ? $_POST['sub_del'] : 0;
if(isset($_POST['sub_del']) || isset($_POST['sub_edit'])) {
foreach($_POST as $key => $value) {
if ( strpos($key, "id_") !== false ) {
$row_id = str_replace("id_","",$key);
if ($row_id > 0) break;
}
}
sub_del is the button you click to delete entries.. sub_edit is the name of the button you click to edit entries.
Here's the code that actually deletes the entries
else if($row_del) {
foreach ($_POST as $id => $value) {
$query = "DELETE FROM polls WHERE id=$row_id"; }
And here's the code used to make the checkboxes that allow me to edit/delete a suggestion.
$maindiv.= "<input type='checkbox' name='id_".$row['id']."'>";
Does anyone have any suggestions on how I can get the script to allow multiple suggestions to be deleted at once? Thanks.
(If you need me to post more of the coding, just let me know.. I only posted what I considered the important snipits, but since this code isn't entirely mine, there could be more that I'm missing... thanks).