I'm trying to set the JavaScript value to a PHP Session variable and get this session value to another php page. here my code. on the same it will show the value using alert. here's my first page index_1.php
<Script>
function(no_user){
`var num_user = no_user;
'<?php $_SESSION["num_user"] = "' + no_user+ '"; ?>';
//alert('<?php echo $_SESSION["num_user"] ?>');*/
window.open("demo.php");
}
</script>
another page index_2.php
<?php
if(isset($_SESSION['num_user'])){
$a = $_SESSION['num_user'];
echo "Number of user: ". $a;
?>