I've tried your suggestion, and I didn't see anything but a blank page here,
although I see the session ID is passed automatically using PHPSESSID (URL
below). Is there something in php.ini that I have to modify to get this to
work? BTW, I'm running Apache 1.3.23 on Windows 2000 if that would make any
difference. Thanks.

http://localhost/reg_2.php?PHPSESSID=1b18cbc3eb64a63b4cd947f6c58201b8




----- Original Message -----
From: "Pac mon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, March 28, 2002 10:15 PM
Subject: Re: [PHP-WIN] HELP: USING $_SESSION instead of session_register()


> Not quite... Here's something that ought to work better for you:
>
> ----page1------
> <?
> session_start();
> if (!isset($_SESSION['foo'])) {
> $_SESSION['foo'] = "test foo";
> }
>
> ?>
> <body>
> <? echo $_SESSION['foo'] . "<br>";
> echo session_id() . "<br>";
>
> echo "<br><br>";
> ?>
> <a href="reg_2.php">reg_2.php</a>
> </body>
>
> ----page2--------
> <?
> session_start();
> ?>
> <body>
> <? print $_SESSION['foo']."<br>"; ?>
> </body>
>
>
>
>
>
>
> ----Original Message Follows----
> From: "Bossanova" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: [PHP-WIN] HELP: USING $_SESSION instead of session_register()
> Date: Thu, 28 Mar 2002 13:06:55 -0800
>
> Pardon my ignorance, I've been searching for answers for this new
$_SESSION to work to no avail. If someone can help me out by giving examples
how I can pass the session_id to the next page and access the same
$_SESSION["var"] on that page, it would be very helpful.
>
> My question is, once I set this on the 1st page:
> <?
> session_start();
> if (!isset($_SESSION["foo"])) {
> $_SESSION["foo"] = "test foo";
> }
>
> ?>
> <body>
> <? echo $_SESSION["foo"] . "<br>";
> echo session_id() . "<br>";
>
> echo "<br><br>";
> ?>
> <a href="reg_2.php?id="<? session_id(); ?>">reg_2.php</a>
> </body>
>
>
> How do I set up link to the next page, and what should I put on the next
page? Will this be correct?
>
> <?
> session_id($_GET["PHPSESSID"]);
> session_start();
> ?>
> <body>
> <? print $_SESSION["foo"]."<br>"; ?>
> </body>
>
>
> But I got this error message:
>
> Warning: Undefined index: foo in c:\phps\reg_2.php on line 6
>
> I'm new to PHP so this is also a major factor of the failure. Again,
thanks for your help.
>
>
>
> Burhan
>
>
> greg wrote:
> -------------------------------
> Use of $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is
recommended for security and code readablity. With $_SESSION or
$HTTP_SESSION_VARS, there is no need to use
session_register()/session_unregister()/session_is_registered() functions.
Users can access session variable like a normal variable.
>
> http://www.php.net/manual/en/ref.session.php
>
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to