hey guys so im trying to delete a row using checkbox but i get an undefined index error = Notice: Undefined index: check in D:\Xampp\htdocs\EMS2\event.php . i think its because the checkbox is echoed(?)maybe? or is it something else that i overlooked?
<tbody class="tbody-event-list-table2">
<?php
require "connection.php";
$check = mysql_query("SELECT * FROM event") or die(mysql_error());
if(mysql_num_rows($check) > 0)
{
while($row = mysql_fetch_array($check))
{
$id = $row['event_id'];
$name = $row['event_name'];
$start = $row['start'];
$end = $row['end'];
$venue = $row['event_venue'];
echo
"<tr>
<td><input type='checkbox' name='check' id='check' class='check' value='$id'/><a href='' class='event-link'>$name</a></td><td>$start</td><td>$end</td><td>$venue</td>";
?>
<?php
if(isset($_POST['del_event']))
{
if(count($_POST['check']) !=0)
{
$array = array("check" => $_POST['check']);
$id = implode(',', $array['check']);
$result = mysql_query("DELETE FROM event WHERE event_id = '$id'") or die(mysql_error());
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=event.php\">";
}
}
}
?>
<?php
echo "</tr>";
}
}
else
{
echo
"<tr>
<td colspan='4'>There Are No Events.</td>
</tr>";
}
?>
</tbody>