sessions and cookies

Forum for you who has PHP installation issues

Moderators: egami, macek, gesf

Post Reply
User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Sat Aug 16, 2003 5:03 pm

I think this should work:

Code: Select all

<?php 
session_start();
header("Cache-control: private");
session_register('out);
$_SESSION["out"] = "tjenare";
?>
<html>
<head>
<title></title>
</head>
<body>
<a href="tva.php">GO</a>
</body>
</html>

The receiving file is tva.php, with the following code.

<?php
session_start();
header("Cache-control: private");
?>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
echo "Out =" .  $_SESSION["out"];
?>
</body>
</html>

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Sat Aug 16, 2003 5:23 pm

Joan Garnet wrote:I think this should work:

Code: Select all

<?php 
session_start();
header("Cache-control: private");
session_register('out);
$_SESSION["out"] = "tjenare";
?>


Looks like you were missing a closing quote on the fourth line above, Joan. It ought to be session_register('out'); Simple typo, I'm sure.

By the way, Tjobbe, I ran your code on my machine and it worked fine. Do different versions of PHP handle this differently?
Image

Joel
New php-forum User
New php-forum User
Posts: 193
Joined: Sat Mar 29, 2003 11:57 pm
Location: Auckland, New Zealand
Contact:

Sat Aug 16, 2003 7:05 pm

When using $_SESSION[] variables, you do not need to use session_register().

TJobbe, are you using an old version of PHP? In older versions $_SESSION isn't available.

EdwardBobadilla
New php-forum User
New php-forum User
Posts: 6
Joined: Sat Dec 20, 2003 11:38 am
Location: Altadena, Pasadena, Orange County, Los Angeles
Contact:

Mon Dec 22, 2003 4:38 pm

i tried this script which is viewable at
"http://www.nelsoncasecorp.com/test1.php" and the output is blank, and suggestions?

redhead
New php-forum User
New php-forum User
Posts: 14
Joined: Thu Mar 04, 2004 11:20 am

Mon Mar 08, 2004 9:55 am

ngfrancisco wrote:I had the same problem before with session under windows. What I did was to create a directory sessiondata and specify it in the PHP.ini file under the session path.


That helped me out so much just want to say thank you :-D

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest