So on one of the pages, I have: (First Page)
if (isset($_SESSION['isSuspend'])){
echo '<script>$("#SuspendModal").modal("show");</script>';
unset($_SESSION['isSuspend']);
}
On the same page I have the modal:
<div class="modal" tabindex="-1" role="dialog" id="SuspendModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Suspension System</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p><?php echo $_SESSION['isSuspend']; ?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Okay</button>
</div>
</div>
</div>
</div>
and on another page: (Second Page)
if ($conn->query($sql) === TRUE){
$_SESSION['isSuspend'] = "You have suspended ".$user_id."!";
header("Location: ../admin/edit.php?user=$user_id");
} else {
echo "DEBUG: Error: ".$sql."<br>".$conn->error;
}
My problem is that on the first page when I click the button suspend, it will direct to the suspend.php which is the second page if it succeeds in adding it to the database it will set the session var to said string. But when it goes back to the first page, the bootstrap modal does not open despite it being called. What am I doing wrong?