You are here: Re: mssing session variable in other page « PHP Programming Language « IT news, forums, messages
Re: mssing session variable in other page

Posted by Jerry Stuckle on 08/13/07 03:00

garks wrote:
> I am the newbie in php
> I have a problem about the session variable
> When I create the session and session variable,
> the variable is set in page 1, but in page 2 the variable is unset
> and I don't know why.
> I have searched a lot of tutorial, I followed all the steps but still
> not work
> Can anybody help me!!~
> Thank you in advanced
>
>
> I have created following code
> page1.php:
>
> <?php
> session_start();
> $_SESSION["test"] = "hello";
> echo $_SESSION['test'];
> header("Location: page2.php");
> ?>
>
> page2.php
>
> <?php
> session_start();
> if( !isset($_SESSION['test'])){
> echo "The variable is not set
> }
> ?>
>
> The output:
> page 1: hello
> page 2: The variable is not set
>

Turn on all errors and enable error reporting to the display.

It's best to do it in the php.ini file. However, you can also add these
to your code as the first things in the file:

error_reporting(E_ALL);
ini_set('display_errors', '1');

That should help you find your problem.



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация