473,327 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Re: SESSION variable

On Aug 2, 6:38*pm, KDawg44 <KDaw...@gmail.comwrote:
On Aug 2, 6:36*pm, KDawg44 <KDaw...@gmail.comwrote:
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. *I need
to set this as part of the session. *Can I either:
1.) *Set the session variable within the script that is called through
the AJAX call. *Will 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.) *Is 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.
Nevermind. Got it working correctly.

Thanks!
Aug 2 '08 #1
2 1416
On Aug 2, 6:54*pm, KDawg44 <KDaw...@gmail.comwrote:
On Aug 2, 6:38*pm, KDawg44 <KDaw...@gmail.comwrote:
On Aug 2, 6:36*pm, KDawg44 <KDaw...@gmail.comwrote:
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. *I need
to set this as part of the session. *Can I either:
1.) *Set the session variable within the script that is called through
the AJAX call. *Will 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.) *Is 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.

Nevermind. *Got 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
Aug 3 '08 #2
On Aug 3, 10:42*am, KDawg44 <KDaw...@gmail.comwrote:
On Aug 2, 6:54*pm, KDawg44 <KDaw...@gmail.comwrote:
On Aug 2, 6:38*pm, KDawg44 <KDaw...@gmail.comwrote:
On Aug 2, 6:36*pm, KDawg44 <KDaw...@gmail.comwrote:
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. *I need
to set this as part of the session. *Can I either:
1.) *Set the session variable within the script that is called through
the AJAX call. *Will 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.) *Is 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.
Nevermind. *Got 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
Good again.... missing a session_start(); on one of the pages....
whoops...
Aug 3 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option...
1
by: Ann Leland | last post by:
I have been using session variables to pass a user name from one ASP page to another inside framesets for 9 months and it stopped working this week. I have made no code changes but there was a...
9
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
4
by: T Ralya | last post by:
I am told that ASP.NET controls the session ID and session variables, but that does not fit my symptoms. I am posting here as directed. I'm hoping that someone can at least recommend something to...
3
by: Alan Wang | last post by:
Hi there, Once my application gets complicated and complicated. I found it's really hard to keep track of Session value I am using in my asp.net application. I am just wondering if anyone have...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.