Session
Posted on
16th Feb 2014 07:03 pm by
admin
I am having a little trouble with a session. Not sure if it is my browser or what. I know I do not have any trouble logging into forums such at these, so not sure why this is not working.
first the code. Just basic code from php documentation plus some added checks.
Code: <?php
// page1.php
if (session_start()) {
echo "OK";
} else {
echo "FAIL";
}
// echo phpinfo();
// echo getcwd();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
print_r($_SESSION);
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
And
Code: <?php
// page2.php
session_start();
echo 'Welcome to page #2<br />';
echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);
print_r($_SESSION);
// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>
There is no reason why this should not work. Can someone go to:
http://www.e-sullivan.com/DIITop25/page1.php
and tell me if it works for you? It shows me that the sessions are being started but the variables are not passing between page1.php and page2.php for me.
No comments posted yet
Your Answer:
Login to answer
331
8
Other forums
Required to login help
I'm trying to set up my site so users have to be logged into the forum to access the site.I've been
ORA-01655: unable to extend cluster SYS.C_FILE#_BLOCK# by 128
Hi all,
Oracle 10g. Linux.
I'm facing the below error while trying to import a dumpfil
sql error
I have been looking at this code for 20mins and can't work out what I am doing wrong. There is somet
Multiple server callbacks (NOT POSTBACKS)
Hello,
I have 2 different javascript client side functions that are on timers. When the timers elap
Search function
I am looking for some guidance from the experts.
I am trying to create a search function. It
Help with PHP and checkboxes
I am posting this for a friend of mine, i wrote a small script for her to process her form data to a
Having problemswith multithreading and prime numbers
I have an assignment when I'm suppose to do the following:
Write a multithreaded Java, Pt
MASS PM
Hello all, I'm trying to send mass private messages to users in my database but keep getting an erro
session variable problem
Session variable is not working in Fire fox i am getting null value but it is working fine in IE.
Adding meta tags under Zend FW
Hello there, recently has come to my hands the FTP of a website which is running under Zend, I would