In a form when a user clicks save I want a messagebox dialogue to display a confirmation message. These are selected php statements, I don't think the issue is here :
session_start();
if (isset($_POST['Submit']) == 'save')
$_SESSION['message'] = "Record Saved";
In the javascript the messagebox is hidden on click :
<script>
$(function(){
$(document).click(function(){
$('.messagebox').hide();
});
});
</script>
If I use this php inside the HTML the messagebox is displayed by default on page load even where there is no message to display. Clicking it hides it.
<?php if(isset($_SESSION['message'])){ ?>
<div class="messagebox">
<?php echo $_SESSION['message']; unset($_SESSION['message']); ?>
</div>
<?php } ?>
I've tried the not empty function but the box doesn't load even on save :
<?php if(isset($_SESSION['message']) && !empty($message)): ?>
<div class="messagebox">
<?php echo $_SESSION['message']; unset($_SESSION['message']); ?>
</div>
<?php endif; ?>
css :
.messagebox {
position:absolute;
background:#810000;
color:#ffffff;
border:3px solid #000000;
font-family: 'Montserrat', sans-serif;
font-size:20px;
height:20px;
width:160px;
z-index:1;
padding:12px 0px 12px 0px;
margin:800px 0px 0px 340px;
text-align:center;
border-radius:10px;
}
I would write this:
as
This would fire the event correctly