Been trying to use modal to create a notification window which notifies the user that the record was successfully created. The idea is that a session confirm is set to yes at the end of the query, and on return to the form page, a modal will pop up for a fixed amount of time, i.e. 2 seconds, notifying the user that the record was successfully added to the table.
Ive been playing around with w3 tutorials but no luck, biggest struggle is trying to understand how to call the modal automatically on page load. This type of modal is perfect, but im unsure how to get rid of the button and automatically load & close on timer.
https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_modal_sm&stacked=h
Within an IF statement. Code on the php page, to feature the modal below:
<?php
$confirmation = strip_tags($_SESSION['confirm']);
if ($confirmation == 'yes') {
echo '<div id="confirm_msg">';
echo 'Record has been successfully created.';
$_SESSION["confirm"] = 'No';
echo '</div>';
}
?>
Ideally, id like to swap the #confirm_msg with an automatic modal, that closes after a few seconds.