Hi
<html> <head> <title>New Page 1</title> </head> <body> <? $myvar = "hello world!"; session_start(); session_register("myvar"); echo "Say: $http_session_vars["myvar"]"; $result = session_is_registered("$http_session_vars["myvar"]"); echo "$result"; ?> </body> </html>
This should set the session, print the contents of myvar and return 1 to the existence of myvar but instead i get a Parse error: parse error, expecting T_STRING' orT_VARIABLE' or `T_NUM_STRING' in cookie.php on line 13
T_STRING' or
Help! 😕
thanks -DF
<?php $myvar = "hello world!"; session_start(); session_register("myvar"); ?> <html> <head> <title>New Page 1</title> </head> <body> <? echo "Say: ".$HTTP_SESSION_VARS['myvar'].""; $result = session_is_registered('myvar'); echo $result; ?> </body> </html>
Try this...
your session_is_registered() line should be -
$result = session_is_registered('myvar');
🙁 It didn't work, I just get:
Say:
and that's it, no error just no variable printed
any ideas?
PS. When u have ($HTTP_SESSION_VARS['myvar']), does it matter whether you use quotes ["myvar "] or inverted commas ['myvar']
Try :
print_r($HTTP_SESSION_VARS);
It will print all the contents of $HTTP_SESSION_VARS. Tell me if you see something...
it prints out...
Array ( )
so it looks like there session values aren't being set
any thoughts?
What if you print $_SESSION ?
print_r($_SESSION);
🙁 nope, still get Array()
after youv'e at least tried to register the session, then go to a page with this code in it:
<?php foreach($_SESSION as $k => $v) { echo "".$k." == ".$v."<br>\n"; } ?>
nope, nothing appears on the page, doH!