The first block of code displays information from a database.
Upon selecting a record using the check boxes, and after the delete button is clicked, the delete code is ran (second code block).
How do I display a "Deleted Successfully" message within the first block of code, upon records deleting successfully?
<?php
$con = mysql_connect("localhost","peter","abc123");
if(!$con) {
die(mysql_error());
}
mysql_select_db("db", $con);
$result = mysql_query("SELECT * FROM person");
while($row = mysql_fetch_array($result)) {
echo '<input type="checkbox" name="deletePerson[]" value="' . $row['id'] . '">';
echo $row['FirstName'];
echo $row['LastName'] . '<br /><br />';
}
mysql_close($con);
?>
<?php
$delete_person = $_POST['deletePerson'];
foreach($delete_person as $id) {
mysql_query("DELETE FROM person WHERE id='$id'");
}
?>