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 Like 8 Dislike
Previous forums Next forums
Other forums

On page view, minus credit
Hello all, please, I need a little help with this script. I am charging one credit (credits can be p

PDO returns erroneous columns from within pdt
Hi All,

This is a truly weird behavior:
When using a simple pdo fetch, erroneous columns a

defining website tags
Hi,

What would be the best way to define tags for my site, such as website title, url etc.

Pulling out some result data from MYSQL
Hey Guys,

I've built a PHP page that has a for just imagine something like registration form

creating a 1 to 100 in a table
hi guys I am a newb in php need some help.

I have a table with 1 column and 100 rows and in

PHP & Images [Resize, Crop, Save]
Hey! Well I have a little dilema, hoping I could find some guidance.

I have a CMS and on the

Problem displaying "scraped" XML data
I'm basicly having trouble displaying XML data scraped from an URL using cURL.

What the code

Error with Font and imagettfbbox
I keep getting an error that says "Warning: imagettfbbox() [function.imagettfbbox]: Could not f

Change image filetype on upload?
Hi,
I've got a form which uploads an image to the server.
Is it possible to change the image t

need help in php variable
i have a php variable on one page
Code: [Select]$lastId = mysql_insert_id($db);
echo $lastId;<

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash