I have a working update page where a user selects an entry and is sent to a page where they can update fields. On clicking either the UPDATE or DELETE buttons under the form the database is updated or deleted. (code below)
(1) Database updates as it should but when user returns to previous listing page it displays the original database entries not the updated entries, until the browser refresh button is pressed. How can I get the listing page to refresh from the updated database automatically?
(2) I would like the confirmation message displayed (as a result of the action shown below), for 5 seconds then redirect back to the original listing page. I have looked at using <?php ob_start(); ?> etc to get around the header problem but can not see where these instructions have to be plaved.
Thanks in advance.
<?php
include_once('heading.inc');
include_once('connectDB.inc');
if ($display_button == 'Delete') { //delete record
$query = "DELETE FROM login WHERE cust_code='$cust_code'";
$result = mysql_query($query) or die ("Could not find login name");
echo "<br><br><br><strong>Confirmed:</strong>User $cust_code Access Deleted<br>";
exit();
}
elseif ($display_button == 'Update User Access') { //update record
$query = "UPDATE login SET passwrd='$passwrd', status='$status' WHERE cust_code='$cust_code'";
$result = mysql_query($query) or die ("Could not find login name");
echo "<br><br><br><div align='center'><strong>Confirmed:</strong> User \"$cust_code\" access has been updated</div><br>";
echo "<br><div align='center'><strong><a href='user_list.php'>Return to User Listing</a></strong></div>";
exit();
}
?>
<?php //code follows for HTML form fields and action buttons