Reply to Re: Can't read $_SESSION variables set by previous request, AJAX

Your name:

Reply:


Posted by Jerry Stuckle on 02/18/07 03:23

Evil Otto wrote:
> My page loads, and calls an init() function that returns content to a
> div on the page, as well as setting a $_SESSION variable. The content
> it returns includes a link that calls the same variable, but I get an
> error that says the index isn't defined.
>
> The second two calls are AJAX-generated. The second call immediately
> echos the $_SESSION variable back after it sets it, and it sets it
> properly. But the subsequent request doesn't see it.
>
> I can't figure this one out, and this sort of function is vital to the
> site I'm building.
>
> Things I've already done:
>
> Put session_start() in the functions that get called after the initial
> pageload. Just generates warnings that a session has already been
> started (by the original pageload).
>
> Checked to make sure the same session is being used by all requests,
> and it is (according to session_id).
>
> Any help is appreciated.
>

session_start() must be called before ANY OUTPUT - including whitespace,
DOCTYPE statement, <head>, etc. 99% of the time people ask about
session problems here, they have already sent output before the call to
session_start() is made, but don't have error reporting enabled.

As the very first lines in the page you're loading, try the following:

<?php
error_reporting(E_ALL);
ini_set("display_errors","1");
?>

No whitespace or anything else before it.


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

[Back to original 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

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