Search the Community
Showing results for tags 'checkbox delete row'.
-
Hi guys! im new to phpfreaks *waving* im trying to delete row from a table that is populated by data from database using checkbox(and it doesnt matter if its just one checkbox or multiple) but its not working, as in nothing happens. no delete, no errors or warnings, just a refresh. table: <form class="event-button-wrap" method="post" action="event.php"> <div class="button-wrap"> <input type="submit" id="del_event" name="del_event" value="Delete Event"/> </div> <div class="event-list-table2" > <table class="event-table"> <thead> <tr> <th>Event Name</th> <th class="head">Event Date</th> <th class="head">Venue</th> </tr> </thead> <tbody class="tbody-event-list-table2"> <?php require "connection.php"; $check = mysql_query("SELECT * FROM event"); if(mysql_num_rows($check) > 0) { while($row = mysql_fetch_array($check)) { $id = $row['event_id']; $name = $row['event_name']; $dstart = $row['start_date']; $venue = $row['event_venue']; echo "<tr> <td> <input type='checkbox' name='check[]' class='check' value='$id'>$name </td> </tr>"; } } else { echo "<tr> <td colspan='4'>There Are No Events.</td> </tr>"; } ?> </tbody> </table> </div> </form> process is before <!DOCTYPE html>: <?php if(isset($_POST['del_event'])) { if(isset($_POST['check'])) { foreach($_POST['check'] as $del_id) { $del_id = (int)$del_id; require "connection.php"; $sqlqueer = mysql_query("DELETE FROM event WHERE event_id = $del_id"); if($sqlqueer) { echo "<meta http-equiv=\"refresh\" content=\"0;URL=event.php\">"; } } } ?> thanks in advance!