You are here: Re: help needed - passing values between two loads of the same page « PHP Programming Language « IT news, forums, messages
Re: help needed - passing values between two loads of the same page

Posted by littlefire on 10/17/88 11:27

Jerry Stuckle wrote:
> Joseph S. wrote:
>
>> Hi,
>>
>>> How about placing it in the $_SESSION array? Start the session at the
>>> beginning of the page and store $s in $_SESSION['s']. Then pull it out
>>> on the second call. (Be sure to clear $_SESSION['s'] on first call to
>>> the page).
>>
>>
>>
>> I did that, the value of $s is getting stored properly in
>> $_SESSION['s'], but in the second load of the page, $_SESSION['s'] is
>> not showing in the case '2' code.
>>
>> Either script does not hav e access to $_SESSION or values held in
>> $_SESSION are removed. Does PHP give an invalid index error in the case
>> that I access $_SESSION['s'] and $_SESSION does not have an 's'
>> element?
>> I am asking this because, it is giving no such error, probably meaning
>> that the $_SESSION array has 's' but the value is getting cleaned.
>>
>> also, in the case '2' code,
>> print_r($_SESSION);
>> outputs nothing at all!
>>
>> Also, I have tried -
>> session_name("samplesession");
>> session_start();
>> in the case '1' code at the start.
>>
>> But in the case '2' code,
>> a session_is_registered("samplesession"); gives a FALSE.
>>
>> I have register_globals=On in my php.ini.
>>
>>
>> Any other function needs to be used?
>>
>>
>> Joseph S.
>>
>
> First of all, you should never have register_globals set to on. It's a
> huge security risk.
>
> As to the session variables not working. They work fine for me.
> However, without seeing your entire code, it's almost impossible to
> determine why sessions are failing.
>
>

The two major causes of session failure:
1. The two pages don't reside on the same domain
2. One of the two pages does not call session_start() - this needs to be
done on every single page where a session var is used

:)

 

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

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