|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
basic session example in tutorial??
I am in desperate need to get a handle on sessions and for the life of me I haven't been able to get a single variable to pass to another page. I am using PHP version 4.3.4 and the latest Apache on an Athlon XP 1600 machine with Windows XP Professional.
My question is this... in the first example of the session tutorial cut and pasted below no value passes. Why? Is there something wrong on my machine? I would have thought the first example would have worked is all. If you could help me clear this thanks in advance. Code below.. <?php // page1.php session_start(); $_SESSION["real_name"] = "Hermawan Haryanto"; print "<a href='page2.php'>Go to this page</a>"; ?> <?php // page2.php session_start(); print $_SESSION["real_name"]; ?> Shouldn't page2.php output Hermawan Haryanto |
|
#2
|
|||
|
|||
|
RE: basic session example in tutorial??
I checked the university server using vpn and the code worked?? Does anyone know if it is a setting problem with php or apache? Its a bit useless having them on the machine if it can't use sessions....
|
|
#3
|
|||
|
|||
|
RE: basic session example in tutorial??
I have a handle on sessions now. I just can't work out why they don't work on my setup at home. Is there something I need to set in php.ini??
Any advice would be interesting... |
|
#4
|
||||
|
||||
|
RE: basic session example in tutorial??
The problem seems to be that you arent registered the session variable.
However the problem could be in your browser as sessions create a cookie which stores the session id for referance later on. If you have cookies disabled you can either enable them or tell php to append the session id to the url using the following format. There are multiple ways to get around the cookie problem above is just one. I hope this helps you solve your problem. |
|
#5
|
|||
|
|||
|
RE: basic session example in tutorial??
i don't have cookies turned off - and the confusing thing is the code from the tutorial worked on the school server but not mine... a bit of a worry.
The code that was there was simply cut and pasted off this sites session tutorial, page 2. Anyway thanks for some ideas. |
|
#6
|
|||
|
|||
|
RE: basic session example in tutorial??
no, never use session_register() and $_SESSION together. session_register() should only be used when global variables are disabled.
check your php.ini for the session save path, make sure the folder is in the web tree with read/write permissions. |
|
#7
|
||||
|
||||
|
RE: basic session example in tutorial??
oh sorry about that session_register(); i slipped up.
|
![]() |
| Viewing: Codewalkers Forums > Other > Tutorials > basic session example in tutorial?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|