469,602 Members | 1,897 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Help with session vars

I have on one page:
session_start();
session_register ("email");
session_register ("firstname");
session_register ("lastname");
$HTTP_SESSION_VARS ["email"] = $email;
$HTTP_SESSION_VARS ["firstname"] = $firstname;
$HTTP_SESSION_VARS ["lastname"] = $lastname;

when i type:
echo $HTTP_SESSION_VARS ["email"] ;
on this page it displays the users email taken from a form.

I then added a link to another page with a form

when i submit the form it goes to a php script which has
echo $HTTP_SESSION_VARS ["email"] ;
This has no result.

Am i doing something wrong?
Apr 11 '07 #1
3 1232
ak1dnar
1,584 Expert 1GB
I have on one page:
session_start();
session_register ("email");
session_register ("firstname");
session_register ("lastname");
$HTTP_SESSION_VARS ["email"] = $email;
$HTTP_SESSION_VARS ["firstname"] = $firstname;
$HTTP_SESSION_VARS ["lastname"] = $lastname;

when i type:
echo $HTTP_SESSION_VARS ["email"] ;
on this page it displays the users email taken from a form.

I then added a link to another page with a form

when i submit the form it goes to a php script which has
echo $HTTP_SESSION_VARS ["email"] ;
This has no result.

Am i doing something wrong?
Start the session on the second page before you call for the session variable.
[PHP]
<?php
session_start();
echo $HTTP_SESSION_VARS ["email"] ;
?>
[/PHP]
Apr 12 '07 #2
Start the session on the second page before you call for the session variable.
[PHP]
<?php
session_start();
echo $HTTP_SESSION_VARS ["email"] ;
?>
[/PHP]
Thanks that worked. Do i want to call session_close(); on every page or only when the user logs out?
Apr 13 '07 #3
exoskeleton
104 100+
only when you log out! but what do you want to do...to close the session or destroy it? :)

not just session_destroy() ... you have to clear all the arrays ... many previous topic about clearing the sessions...try to search in this site...i asked about this few months ago...hehe... :)

more power good sir
Apr 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by james | last post: by
8 posts views Thread by ndsoumah | last post: by
19 posts views Thread by Paul Yanzick | last post: by
3 posts views Thread by Mark | last post: by
5 posts views Thread by VB Programmer | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.