I am trying to show a bootstrap modal on body load based on value from mysql database. I have included bootstrap modal in body and showing it successfully according to database value with:
$resultsPop = mysql_query("select popup from members where mid=" . $mid);
$pop = mysql_result($resultsPop, 0, "popup");
if($pop == 0) {
$popupval = "<script type='text/javascript'>$(window).load(function(){ $('#MyPopUp').modal('show'); });</script>";
} else {
$popupval = "";
}
echo $popupval;
And my modal code is:
<div class="modal fade" id="MyPopUp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="">
<div class="modal-dialog modal-lg">
<div class="modal-content" style="">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Welcome</h4>
</div>
<div class="modal-body" style="text-align: center;">
<span>
Welcome Popup
</span>
</div>
</div>
</div>
</div>
Now, I want to have a checkbox in the modal which on checked can silently pass value 1
and logged in member variable $mid
value to a php page after user clicks on modal close button. So, popup
value in members
table is updated with 1
for that logged in member who do not want popup to be see again.
I have searched for such thing but couldn't successful and I am getting no idea on it.