|
Posted by Nico on 12/10/06 20:24
Hi,
Actually it's quite strange.
I know it's correct, but it doesn't work.
I changed all the necessary things (e.g. aktry.php...)
I suppose to have a problem with session in my localhost.
If I try the example related to sessions and included in the official
php manual:
<?php
// page1.php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// 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>';
?>
<?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']);
// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>
I've the following result:
"Welcome to page #1
page 2
page 2"
If I visit the first link:
"Welcome to page #2
1970 01 01 01:00:00
page 1"
If I vist the second link:
"Welcome to page #2
greencat2006 12 10 21:24:02
page 1"
It seems that in the first case sessions don't work.
Why? I'm not able to understand.
Can you help me please?
Should I change something in my php.ini or httpd.conf?
Many thanks.
Cheers,
Nico
In article <1165780715.458164.109920@16g2000cwy.googlegroups.com>,
"theCancerus" <thecancerus@gmail.com> wrote:
> hi Nico
> the example i provided to you works but for it to work you must "submit
> your form, via input with
> > type="submit" as pointed above....
>
> also replace aktry.php in my example with name of the file in which the
> code was saved
>
> it will work with out fail.. in case it does not the canyou show me the
> exact out put what it dispalys
>
[Back to original message]
|