javascript - Display an alert box in php and navigate back -
i want display javascript alert box in php , navigate main page. here code
session_start(); $name= $_session['name']; $id= $_session['id']; //check if guest if($name=="guest"){ echo'<script type="text/javascript">alert(" not allowed view contnent"); </script>'; header('location: mainpage.php'); } //the rest of page
with code alert popup not displayed redirection. try this
$name= $_session['name']; $id= $_session['id']; //check if guest if($name=="guest"){ echo'<script type="text/javascript">window.alert(" not allowed view contnent");</script>'; echo'<script type="text/javascript> window.navigate("mainpage.php"); </script>'; } //the rest of page
now popup displayed redirection not work.
$name= $_session['name']; $id= $_session['id']; //check if guest if($name=="guest"){ echo'<script type="text/javascript">window.alert(" not allowed view contnent");</script>'; echo'<script type="text/javascript> window.location.href="mainpage.php"; </script>'; }
please review code
Comments
Post a Comment