I am trying to get it so a alert box shows up after a query to the database has been made and the user has been headered back to a page on my website with a js alert box telling them success or something went wrong.
I found a jquery script but I just cant seem to get it to work/run when required. Below are 2 snippets of code from 2 pages. 1 page is the index and the other is the php/MySQL process.
Below is the code on my index page
<html>
<head>
<meta charset="UTF-8">
<title>........</title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
/////////////////////////////BELOW IS THE CCS INCLUDE FOR THE ALERT
<link rel="stylesheet" href="jquery/jquery-alerts.css">
/////////////////////////////BELOW IS THE JQUERY INCLUDE FOR THE ALERT
<script src="jquery/jquery-alerts.js"></script>
</head>
<body>
<div id="pageMiddle">
//////////////////This is the $_SEESION ARRAY CONTAINING THE ALERT TRIGGER
<?php
if(isset($_SESSION['errors']['error5301']) && $_SESSION['errors']['error5301'] == 1) { ?>
<script>
alert = function(message, title, callback){
$.alerts.alert(message, title, callback); };
</script>
<?php } ?>
THIS IS JUST CONTENT ON THE WEBSITE...................
</div>
//////////////THIS IS TO UNSET THE ERROR $_SEESION
<?php
if(isset($_SESSION['errors']))
{
unset($_SESSION['errors']);
}
?>
</body>
</html>
Below is the code on my PHP/MySQL process page after the process has taken place. this is directly after the query and within the same set of { } as the query. The header works fine.
header("location: index.php");
$_SESSION['errors']['error5301'] = 1;
session_write_close();
exit();
Below is the website I got the jquery from and the alert box I am trying to sort out is one at the top of the page
http://labs.abeautifulsite.net/archived/jquery-alerts/demo/
Thank you for your time and I look forward to your help.