Re: header-session problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm afraid that's not what the seesion is all about.
The session is a unique value. It is assigned to a cookie if specified in
php.ini or is tagged along in all your URLs as a query string or $_GET and
has the name PHPSESSID by default unless you change it.
If you want to save something fro page 1 and retrieve it in page 3, then you
will need to do the same hing and store this value as a cookie.
$_COOKIE['cookiename'] will retrieve it.
But there are some provisos. You cannot assign a cookie value and set
header("Location.. etc on the same page, the cookie will not be set. You
need to set a cookie and let the page return to the browser.
That's with Windows environments anyway.

Alan

"Sudeep sarath" <sudeepfiles@xxxxxxxxxxx> wrote in message
news:20040216091829.8381.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Dear php-freaks,
>
> My o/s is Windows 98 SE. I am using PWS as my web server and i use recent
version of php (i guess php 4.3.4). I recently started working on PHP and
came across this problem.
> I have three pages. i.e page1.php, page2.php, page3.php.
>
> Page1.php
>
> <HTML>
> <BODY>
> <form name=form1 action=page2.php method=post>
> <input type=text name=t1>
> </form>
> </body>
> </HTML>
>
> Page2.php
>
> <?php ob_start(); ?>
> <?php
> session_start();
> $_SESSION["check"]=$_POST["t1"];
> header("Location: http://www.mypage.com/page3.php";);
> ?>
>
> Page3.php
>
> <?php
> echo $_SESSION["check"];
> ?>
>
>
> So i want page3.php to display what i typed in the text field of
page1.php.
>
> But page3.php says undefined variable in $_SESSION........
> That means session is lost when i redirect to page3.php from page2.php.
>
> If i echo that SESSION in page2.php itself. It dispalys correctly. So i
think that there is a problem with header and session. Please anyone tell me
how to get over this.
>
>
>
>
> Yahoo! India Insurance Special: Be informed on the best policies,
services, tools and more.

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux