Link to home
Start Free TrialLog in
Avatar of jimfrith
jimfrith

asked on

PHP session only works after a refresh

I am using sessions with multiple php pages.  The session variables do not work until The second time I view the page (i.e. refresh)

I tried a simple version of sessions and had the same results.

<?PHP
session_start();
$_SESSION ["var"] = "val";
echo $var;
echo $PHPSESSID;
?>

the echo for both the $var and the $PHPSESSID do not show up until I refresh the page.  How do I use sessions without refreshing?
ASKER CERTIFIED SOLUTION
Avatar of minnirok
minnirok

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of minnirok
minnirok

and put your opening <?php tag in the right place ;)