Problem is: session is not being set another time after the page is redirected. Have a look at my code:
login.php
<?php
session_start();
$pg=$_SERVER["REQUEST_URI"];
$pg=substr($pg,0,11);
$_SESSION['pg']=$pg;
?>
<form action='test.php'>
...
...
</form>
test.php
<?php
session_start();
$pg=$_SESSION['pg'];
if(some_condition){
echo "<script>";
echo "window.location='".$pg."'";
echo "</script>";
}
?>
First time, it works fine, it redirects to login.php. After first redirect (test.php to login.php), session is not being set again & so no redirect then after.
Can anyone tell why session is not being set after redirect?