Click here to get back home

Re: SESSION variable

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Re: SESSION variable KDawg44 08-02-2008
Get Chitika Premium
Posted by KDawg44 on August 2, 2008, 6:38 pm
Please log in for more thread options
> Hi,
>
> I have a variable I would like to put in the $_SESSION array.
> However, I am not accessing this through a PHP script but am instead
> returning this to a javascript function through an AJAX call. =A0I need
> to set this as part of the session. =A0Can I either:
>
> 1.) =A0Set the session variable within the script that is called through
> the AJAX call. =A0Will I be able to call for this on successive pages?
> The page is accessed only through the AJAX call so will the SESSION
> variable be set properly?
>
> or
>
> 2.) =A0Is there a way that I can pass the data received back from the
> AJAX call (in a javascript function) into a PHP function in the same
> document to then set it in the session?
>
> The call is being made through the AJAX call and this cannot be
> changed.
>
> Thanks for any insight.
>
> Kevin

Okay, when I read my own question, I think #2 doesn't even make sense
since PHP is server side and js is client side. So, can #1 be done
properly?

Thanks.

Posted by KDawg44 on August 2, 2008, 6:54 pm
Please log in for more thread options
>
>
>
> > Hi,
>
> > I have a variable I would like to put in the $_SESSION array.
> > However, I am not accessing this through a PHP script but am instead
> > returning this to a javascript function through an AJAX call. =A0I need
> > to set this as part of the session. =A0Can I either:
>
> > 1.) =A0Set the session variable within the script that is called throug=
h
> > the AJAX call. =A0Will I be able to call for this on successive pages?
> > The page is accessed only through the AJAX call so will the SESSION
> > variable be set properly?
>
> > or
>
> > 2.) =A0Is there a way that I can pass the data received back from the
> > AJAX call (in a javascript function) into a PHP function in the same
> > document to then set it in the session?
>
> > The call is being made through the AJAX call and this cannot be
> > changed.
>
> > Thanks for any insight.
>
> > Kevin
>
> Okay, when I read my own question, I think #2 doesn't even make sense
> since PHP is server side and js is client side. =A0So, can #1 be done
> properly?
>
> Thanks.

Nevermind. Got it working correctly.

Thanks!

Posted by KDawg44 on August 3, 2008, 10:42 am
Please log in for more thread options
>
>
>
>
> > > Hi,
>
> > > I have a variable I would like to put in the $_SESSION array.
> > > However, I am not accessing this through a PHP script but am instead
> > > returning this to a javascript function through an AJAX call. =A0I ne=
ed
> > > to set this as part of the session. =A0Can I either:
>
> > > 1.) =A0Set the session variable within the script that is called thro=
ugh
> > > the AJAX call. =A0Will I be able to call for this on successive pages=
?
> > > The page is accessed only through the AJAX call so will the SESSION
> > > variable be set properly?
>
> > > or
>
> > > 2.) =A0Is there a way that I can pass the data received back from the
> > > AJAX call (in a javascript function) into a PHP function in the same
> > > document to then set it in the session?
>
> > > The call is being made through the AJAX call and this cannot be
> > > changed.
>
> > > Thanks for any insight.
>
> > > Kevin
>
> > Okay, when I read my own question, I think #2 doesn't even make sense
> > since PHP is server side and js is client side. =A0So, can #1 be done
> > properly?
>
> > Thanks.
>
> Nevermind. =A0Got it working correctly.
>
> Thanks!

Nevermind... I do NOT have it working correctly.... thought I did.

It appears that setting $_SESSION['var'] in the script that is called
by AJAX and then trying to retrieve it on another PHP page is not
working.

I guess I will have to use JavaScript cookies to accomplish my task
unless anyone else can lead me any where else.

Thanks.

Kevin

Posted by KDawg44 on August 3, 2008, 11:27 am
Please log in for more thread options
>
>
>
>
>
> > > > Hi,
>
> > > > I have a variable I would like to put in the $_SESSION array.
> > > > However, I am not accessing this through a PHP script but am instea=
d
> > > > returning this to a javascript function through an AJAX call. =A0I =
need
> > > > to set this as part of the session. =A0Can I either:
>
> > > > 1.) =A0Set the session variable within the script that is called th=
rough
> > > > the AJAX call. =A0Will I be able to call for this on successive pag=
es?
> > > > The page is accessed only through the AJAX call so will the SESSION
> > > > variable be set properly?
>
> > > > or
>
> > > > 2.) =A0Is there a way that I can pass the data received back from t=
he
> > > > AJAX call (in a javascript function) into a PHP function in the sam=
e
> > > > document to then set it in the session?
>
> > > > The call is being made through the AJAX call and this cannot be
> > > > changed.
>
> > > > Thanks for any insight.
>
> > > > Kevin
>
> > > Okay, when I read my own question, I think #2 doesn't even make sense
> > > since PHP is server side and js is client side. =A0So, can #1 be done
> > > properly?
>
> > > Thanks.
>
> > Nevermind. =A0Got it working correctly.
>
> > Thanks!
>
> Nevermind... I do NOT have it working correctly.... =A0thought I did.
>
> It appears that setting $_SESSION['var'] in the script that is called
> by AJAX and then trying to retrieve it on another PHP page is not
> working.
>
> I guess I will have to use JavaScript cookies to accomplish my task
> unless anyone else can lead me any where else.
>
> Thanks.
>
> Kevin

Good again.... missing a session_start(); on one of the pages....
whoops...

Similar ThreadsPosted
What? Assigning a session variable also assigns the local variable? April 12, 2005, 3:12 am
session variable August 25, 2004, 2:54 pm
Re: session variable August 25, 2004, 6:26 am
Re: session variable August 25, 2004, 7:37 am
Re: session variable August 25, 2004, 8:21 am
Session variable July 9, 2005, 3:52 pm
php session variable July 3, 2007, 6:07 pm
use SESSION variable? June 29, 2008, 4:07 pm
SESSION variable August 2, 2008, 6:36 pm
Receiving variable from session September 2, 2004, 5:58 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap