You are here: Re: [PHP] understanding session vars ? « PHP « IT news, forums, messages
Re: [PHP] understanding session vars ?

Posted by David Grant on 11/24/05 10:55

Gregory,

Are you always setting $_SESSION['menu'] to the contents of
$_GET['menu']? If so, the second link will set $_SESSION['menu'] to
null. You need to check the contents of $_GET['menu'] first before
setting, i.e.

if (isset($_GET['menu']))
$_SESSION['menu'] = $_GET['menu'];

Cheers,

David Grant

Gregory Machin wrote:
> Hi
> I'm a bit stuck on session var, and thier implamentation, or my perseption
> thier of.
> I have a page and need certian vars to be persistat each time the page is
> called.
> This is done to detmin the content of the page through logic that calls
> different includes.
>
> But I cant get the vars to be persistant.
> note the page call it's self.
>
> ./index.php
> <?php
> session_start();
> $_SESSION['menu']
>
> ?>
> <html><A href=./index.php?menu=1>option 1</A></html> // this works
> <html><A href=./index.php?other=do>differnt action</A></html> // this brakes
> it . when the user links here the 'menu' var is cleared
> <?php $_SESSION['menu'] = $_GET['menu'];
> echo $_SESSION['menu'];
>
> ?>
>
> I would like the menu var (and others) to be persistant until it is reset or
> updated. how do I acheave this .
>
> Thanks
>
>
>
>
>
>
> --
> Gregory Machin
> greg@linuxpro.co.za
> gregory.machin@gmail.com
> www.linuxpro.co.za
> www.exponent.co.za
> Web Hosting Solutions
> Scalable Linux Solutions
> www.iberry.info (support and admin)
>
> +27 72 524 8096

 

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

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