473,545 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Must set and immediately get $_SESSION variable - help!

This is an urgent request (as always)

Expand|Select|Wrap|Line Numbers
  1.  
  2. generate_admin_customer_position_dropdown($customerResult,
  3. $customerResult[0]->id);
  4. print_r($_SESSION["${projectAcronym}_customerSOWObjectArray"]);
  5.  
This code will generate an HTML dropdown as well as set a $_SESSION
variable.

I can verify the function works perfectly and in fact sets the session
variable every time. Problem is that I need to set and then
IMMEDIATELY get the session variable w/o redirection because
redirection is undoable at the portion of the PHP code that this must
work in.

What do I do? Each time I try this the session variable is NOT
immediately available until a latter iteration renders it available but
far too late to be used.

How do I set and then IMMEDIATELY get a SESSION variable? This is an
urgent request!!

Thanx
Phil

Feb 26 '06 #1
4 1930
comp.lang.php wrote:
This is an urgent request (as always)

Expand|Select|Wrap|Line Numbers
  1.       generate_admin_customer_position_dropdown($customerResult,
  2.  $customerResult[0]->id);
  3.       print_r($_SESSION["${projectAcronym}_customerSOWObjectArray"]);
  4.  

This code will generate an HTML dropdown as well as set a $_SESSION
variable.

I can verify the function works perfectly and in fact sets the session
variable every time. Problem is that I need to set and then
IMMEDIATELY get the session variable w/o redirection because
redirection is undoable at the portion of the PHP code that this must
work in.

What do I do? Each time I try this the session variable is NOT
immediately available until a latter iteration renders it available but
far too late to be used.

How do I set and then IMMEDIATELY get a SESSION variable? This is an
urgent request!!

Thanx
Phil


Maybe just store it in a work variable? Why does it HAVE to come from
the $_SESSION variable?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Feb 26 '06 #2
"comp.lang. php" <ph************ **@gmail.com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
This is an urgent request (as always)

Expand|Select|Wrap|Line Numbers
  1.  generate_admin_customer_position_dropdown($customerResult,
  2.  $customerResult[0]->id);
  3.  print_r($_SESSION["${projectAcronym}_customerSOWObjectArray"]);
  4.  

This code will generate an HTML dropdown as well as set a $_SESSION
variable.

I can verify the function works perfectly and in fact sets the session
variable every time. Problem is that I need to set and then
IMMEDIATELY get the session variable w/o redirection because
redirection is undoable at the portion of the PHP code that this must
work in.

What do I do? Each time I try this the session variable is NOT
immediately available until a latter iteration renders it available but
far too late to be used.

How do I set and then IMMEDIATELY get a SESSION variable? This is an
urgent request!!

Thanx
Phil


Not exactly sure what you mean... How can you verify that the $_SESSION
variable is set if you also state you can't access it.

place this before your print_r statement: echo "<!-- SESSION
status:\n\r".va r_dump($_SESSIO N)."\n\r-->";

then look in the source code of the resulting page. This will show you all
the $_SESSION variables and their values.

I can set a session and immediatley access it all day long... it has to be
something else. To me it appears that this could be the culprit:

print_r($_SESSI ON["${projectAcron ym}_customerSOW ObjectArray"]);

....what is "${projectAcron ym}_customerSOW ObjectArray"? In otherwords what
is 'projectAcronym '? It can do it this way too, no problem. If
'projectAcronym ' is a variable (it really has a $ in front of it) then you
need to make sure it is set properly. The $ can go inside the curly braces
as well and should keep things easier to read. Just try entering the little
code snippet above and you'll see what the session variables are.

Norm


Feb 26 '06 #3

Jerry Stuckle wrote:
comp.lang.php wrote:
This is an urgent request (as always)

Expand|Select|Wrap|Line Numbers
  1.  >
  2.  >      generate_admin_customer_position_dropdown($customerResult,
  3.  > $customerResult[0]->id);
  4.  >      print_r($_SESSION["${projectAcronym}_customerSOWObjectArray"]);
  5.  > 

This code will generate an HTML dropdown as well as set a $_SESSION
variable.

I can verify the function works perfectly and in fact sets the session
variable every time. Problem is that I need to set and then
IMMEDIATELY get the session variable w/o redirection because
redirection is undoable at the portion of the PHP code that this must
work in.

What do I do? Each time I try this the session variable is NOT
immediately available until a latter iteration renders it available but
far too late to be used.

How do I set and then IMMEDIATELY get a SESSION variable? This is an
urgent request!!

Thanx
Phil

Maybe just store it in a work variable? Why does it HAVE to come from
the $_SESSION variable?


The function returns an HTML string variable, I don't know of any other
way in PHP to store it for latter (but immediate) retrieval other than
via $_SESSION.

Else, please explain "work variable" to me.

Phil
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===


Feb 27 '06 #4

Norman Peelman wrote:
"comp.lang. php" <ph************ **@gmail.com> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
This is an urgent request (as always)

Expand|Select|Wrap|Line Numbers
  1.  >
  2.  > generate_admin_customer_position_dropdown($customerResult,
  3.  > $customerResult[0]->id);
  4.  > print_r($_SESSION["${projectAcronym}_customerSOWObjectArray"]);
  5.  > 

This code will generate an HTML dropdown as well as set a $_SESSION
variable.

I can verify the function works perfectly and in fact sets the session
variable every time. Problem is that I need to set and then
IMMEDIATELY get the session variable w/o redirection because
redirection is undoable at the portion of the PHP code that this must
work in.

What do I do? Each time I try this the session variable is NOT
immediately available until a latter iteration renders it available but
far too late to be used.

How do I set and then IMMEDIATELY get a SESSION variable? This is an
urgent request!!

Thanx
Phil

Not exactly sure what you mean... How can you verify that the $_SESSION
variable is set if you also state you can't access it.

place this before your print_r statement: echo "<!-- SESSION
status:\n\r".va r_dump($_SESSIO N)."\n\r-->";

then look in the source code of the resulting page. This will show you all
the $_SESSION variables and their values.

I can set a session and immediatley access it all day long... it has to be
something else. To me it appears that this could be the culprit:

print_r($_SESSI ON["${projectAcron ym}_customerSOW ObjectArray"]);

...what is "${projectAcron ym}_customerSOW ObjectArray"? In otherwords what
is 'projectAcronym '? It can do it this way too, no problem. If
'projectAcronym ' is a variable (it really has a $ in front of it) then you
need to make sure it is set properly. The $ can go inside the curly braces
as well and should keep things easier to read. Just try entering the little
code snippet above and you'll see what the session variables are.


Thanks, however, over the weekend I was able to brute-force it to work
by rewriting the entire function. To not dump out a 100-line function
to solve you all the heartache of dealing with mounds of raw code,
basically, it works now, sets and gets $_SESSION variable as it should,
so thanx!

Phil
Norm


Feb 27 '06 #5

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

Similar topics

1
2888
by: Daniel | last post by:
For an odd reason that I cannot figure out on my own, when a user attempts to log-in on my Log-In page, they must press the submit button twice. They fill out their credentials (username, password), then press submit. The postdata is indeed sent the first time around. I used echo to show the values. Then a second submit is required for the...
5
2964
by: Ken | last post by:
What am I doing wrong? I set the variable co_name on the first page with an <input.... > and session_start() at the top of both pages. Clicking on a link that takes me to the second page: Script on the second page. echo $_SESSION; Does not display
3
14896
by: Phil Powell | last post by:
PHP: unset($_SESSION); In my original environment (PHP 4.3.2) this line will delete the session variable 'mainDisplay'. But in the testing environment (PHP 4.3.6) the variable persists even after unset() is called. Is there some special setting in PHP that can allow a session to
12
41132
by: Michael Windsor | last post by:
I've been trying to integrate some PHP pages of my own with some existing code. The details of this are for the support forums for that code (where I have been asking questions), but I wonder if someone here can enlighten me as to why the problematic code is having the effect it is. For reasons I don't know, if the PHP version is 5 or...
2
1813
by: somecrazyguy | last post by:
Take the following code, one would think that there was absolutely no link between $test and $_SESSION. But if you reload the page, guess what... "After=FAILED". Why? Because for some reason, writing to $test affects the $_SESSION variable $_SESSION. session_start(); ini_set("session.gc_maxlifetime","3600"); if ($_REQUEST == "1")...
1
2863
by: bsprogs | last post by:
I am currnetly programming a file hosting website in PHP and I am slowly integrating AJAX into the website. Here is my problem: The user uploads the file. The server processes the file and stores a $_SESSION variable. After the upload is complete, the server supplies a link that allows the user to view their link codes. Once they click...
4
2337
by: dpinion | last post by:
Greetings, I am trying to do some simple session stuff. However it does not seem as though the session variable is being created for my site. I am running the latest version of PHP and apache that I installed as part of WAMP. Machine is XP SP2. Basically I am trying to do something simple such as: <?php
2
2260
by: sharonDonnelly | last post by:
Hi Really dumb problem that's got me beat. Can someone help. The prolem: I'm trying to count the number of times an item has been clicked. There are many items. I want to create a session variable for each item as its clicked, and increment the value held by the session variable by 1 each time that item is clicked. My plan was to allow an...
4
1803
TheServant
by: TheServant | last post by:
Hi guys, This is my situation. I have 3 sets of data used on every page of my website. Two of these never change, and the reason they are stored in MySQL and recalled into the $_SESSION variable is simply because I want to have one place to update/change them if I ever need to. What I have been wondering is if I should leave the user specific...
0
7487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5349
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.