Re: Session data disappearing?

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

 



Colin Ross wrote:
In edit_schedule.phps:

if (isset($_POST['add_available'])){
$year = $_POST['year'];
$year = $year['NULL'];
$month = $_POST['month'];
$month = $month['NULL'];
$day = $_POST['day'];
$day = $day['NULL'];
$time = $_POST['time'];
$time = $time['NULL'];
...
}
after this is done.. $year, $month, $day, and $time should all be arrays with a single
'null' (not the keyword null though) item with no value. ie.
array(NULL=>);


what ARE you trying to do, you are making the POST vars global:
    $day = $_POST['day'];
OK. (why do you even need to do this? whatever, matter of taste i guess..)
But then you over write their values, making them arrays with that
single element 'NULL'
    $day = $day['NULL'];
Not seeing the logic here...

didn't spot this yet. will take another look - maybe this is the prob? hmm.


Overall, and not to mean offence, but your code is kinda sloppy and has syntax and logic errors.

Richards style is just different to yours, me thinks.


<?="$slot", ($taken ? ' <FONT COLOR="RED">TAKEN</FONT>' : '')?> SHOULD be erroring up (if you have errors turned on, please say you do for development)

Richard aint no noob :-) ...the syntax you point out as being bad is completely legal.

try:
<?php echo $slot;  if ($taken) echo '<FONT COLOR="RED">TAKEN</FONT>'; ?>

and btw, the short conditional syntax is:
(condition) ? true : false;
// ie. (note the empty string... you gotta have SOMETHING there
[right?i think so]
echo ($taken) ? '<FONT COLOR="RED">TAKEN</FONT>' : '' ;

Colin

On Mon, 28 Mar 2005 20:27:00 -0800 (PST), Richard Lynch <ceo@xxxxxxxxx> wrote:

Can anybody 'splain under what conditions $_SESSION values would turn into
&NULL for no reason I can figure out?

It happens consistently on this one FORM submission, but works fine on
others.

PHP 5.0.3
FreeBSD 5.3-RELEASE

Tried with Cookies and with trans_sid

No difference.

Tried altering the session.name and no difference.

Naturally, I can't pare it down to a smaller example yet. :-(

I'm calling session_start(), for sure.

I'm dumping out session_id() and it has the same 32-character value as
before.

But one page has $_SESSION data, and the next, "poof" all the
&string(#)="#####" values turn into &NULL

Actually only two out of three values was disappearing for awhile.

This worked fine under Windows XP on my laptop, so I'm reasonably certain
it's not my code at fault, at least not totally.  Working versions:
PHP 4.3.9
Windows XP Home Edition

I've searched bugs.php.net, and found nothing that matched up in any
obvious way to what I'm experiencing, though maybe I just missed it.

Hmmmm.  Maybe I can blame the CSS somehow.  That always seems to screw me
up. :-v

Anybody willing to poke at it can email me off list for a
username/password and I'll set it up for you to see it in action.

Source code (kinda long, sorry):
http://acousticdemo.com/edit_schedule.phps
http://acousticdemo.com/globals.phps
http://acousticdemo.com/client_id.phps
http://acousticdemo.com/global.phps (CSS)

--
Like Music?
http://l-i-e.com/artists.htm

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





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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux