Something strange has just started to happen as I have been developing
a db application on a site. Suddenly a session variable has stopped
working as I pass it from 1 page to another (I am sure it was OK a few
days ago).
I have done some tests.
$temp = 67;
echo $temp; gives 67 on this page
S_SESSION['org'] = $temp;
Passes ok and has value 67 on the next page
$temp = "abc"
echo $temp gives "abc" on this page
S_SESSION['org'] = $temp;
Passes ok and has value abc on the next page
$temp = $_POST['CUST_ORG']
echo $temp; gives "org 1" on this page
S_SESSION['org'] = $temp;
No value on next page
Other session variables seem ok also.
Confused of Bromley
Thanks John 18 1744
John wrote:
Something strange has just started to happen as I have been developing
a db application on a site. Suddenly a session variable has stopped
working as I pass it from 1 page to another (I am sure it was OK a few
days ago).
I have done some tests.
$temp = 67;
echo $temp; gives 67 on this page
S_SESSION['org'] = $temp;
Passes ok and has value 67 on the next page
$temp = "abc"
echo $temp gives "abc" on this page
S_SESSION['org'] = $temp;
Passes ok and has value abc on the next page
$temp = $_POST['CUST_ORG']
echo $temp; gives "org 1" on this page
S_SESSION['org'] = $temp;
No value on next page
Other session variables seem ok also.
Confused of Bromley
Thanks John
And you have gone back with the values you know that work just to make
sure you did not goof up the code after testing the one that does not work?
Maybe it's a typo here but S_SESSION should be $_SESSION.
Shoot us the actual code, sometimes there are small procedural problems
that don't transcribe when writing it to the NG.
Scotty
On Sat, 01 Nov 2008 07:16:09 -0700, FutureShock <fu**********@a tt.net>
wrote:
>John wrote:
>Something strange has just started to happen as I have been developing a db application on a site. Suddenly a session variable has stopped working as I pass it from 1 page to another (I am sure it was OK a few days ago).
I have done some tests.
$temp = 67; echo $temp; gives 67 on this page S_SESSION['org'] = $temp;
Passes ok and has value 67 on the next page
$temp = "abc" echo $temp gives "abc" on this page S_SESSION['org'] = $temp;
Passes ok and has value abc on the next page
$temp = $_POST['CUST_ORG'] echo $temp; gives "org 1" on this page S_SESSION['org'] = $temp;
No value on next page
Other session variables seem ok also.
Confused of Bromley
Thanks John And you have gone back with the values you know that work just to make sure you did not goof up the code after testing the one that does not work?
Maybe it's a typo here but S_SESSION should be $_SESSION.
Shoot us the actual code, sometimes there are small procedural problems that don't transcribe when writing it to the NG.
Scotty
Thanks Scotty
My mistake in this post I'm afraid. All $_SESSION variables correct.
Here they are cut & pasted -
Page 1 - Set up
$_SESSION['org_details'] = $_POST['ORD_ORG'];
Page 1 use
<h1><?php echo $_SESSION['org_details']; ? OK
Page 2 use
echo $_SESSION['org_details'];
Value is empty
John
John wrote:
Something strange has just started to happen as I have been developing
a db application on a site. Suddenly a session variable has stopped
working as I pass it from 1 page to another (I am sure it was OK a few
days ago).
I have done some tests.
$temp = 67;
echo $temp; gives 67 on this page
S_SESSION['org'] = $temp;
Passes ok and has value 67 on the next page
$temp = "abc"
echo $temp gives "abc" on this page
S_SESSION['org'] = $temp;
Passes ok and has value abc on the next page
$temp = $_POST['CUST_ORG']
echo $temp; gives "org 1" on this page
S_SESSION['org'] = $temp;
No value on next page
Other session variables seem ok also.
Confused of Bromley
Thanks John
Are you using anything like Smarty templates or some other such thing?
Does debug or verbose output help show anything?
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
On Sat, 01 Nov 2008 13:17:28 +0000, John <67vnue6o@knwfv wrote:
Here's the testing I did -
PAGE 1 CODE
$_SESSION[org_details] = $_POST['ORD_ORG'];
echo "1-$_SESSION[org_details]*<BR>";
$temp = 67;
$_SESSION[org_details1] = $temp;
echo "2-$temp-$_SESSION[org_details1]*<BR>";
$temp = $_POST['ORD_ORG']."1";
$_SESSION[org_details2] = $temp;
echo "3-$temp-$_SESSION[org_details2]*<BR>";
$temp = "adbr";
$_SESSION[org_details3] = $temp;
echo "4-$temp-$_SESSION[org_details3]*<BR>";
PAGE 1 RESULTS
1-Deptford Boys School*
2-67-67*
3-Deptford Boys School1-Deptford Boys School1*
4-adbr-adbr*
PAGE 2 CODE
echo
"--$_SESSION[org_details]-<BR>--$_SESSION[org_details1]-<BR>--$_SESSION[org_details2]-<BR>--$_SESSION[org_details3]";
PAGE 2 RESULTS
---
--67-
--1-
--adbr
(The strings inside the [] don't seem to make a difference)
John
John <67vnue6o@knwfv wrote:
echo
"--$_SESSION[org_details]-<BR>--$_SESSION[org_details1]-<BR>--$_SESSION[org_details2]-<BR>--$_SESSION[org_details3]";
PAGE 2 RESULTS
---
--67-
--1-
--adbr
(The strings inside the [] don't seem to make a difference)
Maybe you intended:
echo "--{$_SESSION['org_details']}--<BR... etc etc?
HTH,
--
Charles
On Sat, 01 Nov 2008 19:23:07 +0000, Charles Polisher
<cp*****@nonesu ch.comwrote:
>John <67vnue6o@knwfv wrote:
>echo "--$_SESSION[org_details]-<BR>--$_SESSION[org_details1]-<BR>--$_SESSION[org_details2]-<BR>--$_SESSION[org_details3]";
PAGE 2 RESULTS --- --67- --1- --adbr
(The strings inside the [] don't seem to make a difference)
Maybe you intended:
echo "--{$_SESSION['org_details']}--<BR... etc etc?
HTH,
Thanks Charles.
I can't see why the others work without the brace though.
I stored the $_POST value in a db so I was able to pull it out again
which defeats the use of the session variable.
There seems to be some conflict between POST and SESSION but I can't
think what I have chabged that could make a difference.
--
John
John wrote:
On Sat, 01 Nov 2008 19:23:07 +0000, Charles Polisher
<cp*****@nonesu ch.comwrote:
>John <67vnue6o@knwfv wrote:
>>echo "--$_SESSION[org_details]-<BR>--$_SESSION[org_details1]-<BR>--$_SESSION[org_details2]-<BR>--$_SESSION[org_details3]";
PAGE 2 RESULTS --- --67- --1- --adbr
(The strings inside the [] don't seem to make a difference)
Maybe you intended: echo "--{$_SESSION['org_details']}--<BR... etc etc?
HTH,
Thanks Charles.
I can't see why the others work without the brace though.
I stored the $_POST value in a db so I was able to pull it out again
which defeats the use of the session variable.
There seems to be some conflict between POST and SESSION but I can't
think what I have chabged that could make a difference.
All i can think of doing now to verify your values is output all your
session values.
print_r($_SESSI ON);
on both pages and see what comes out for sure.
Also you may want to print_r($_POST) on page one to verify your values
there too.
Always remember 'junk in, junk out'
Scotty
Message-ID: <5u************ *************** *****@4ax.comfr om John
contained the following:
>Here's the testing I did -
That's still not the whole code, we can't see the form that produces the
$_POST variable. My guess is that you are reloading the page somehow
without posting the form which is destroying the session variable.
You will be better off using concatenation with session variables to
avoid possible problems with mathematical operators (eg - and * )
echo
'--'.$_SESSION['org_details'].'-<BR>--'.$_SESSION['org_details1'].'-<BR>--'.$_SESSION['org_details2'].'-<BR>--.'$_SESSION['org_details3'];
Reduce it down to the smallest possible snippets of code that produce
the problem. If the solution is not obvious, post the code.
--
Geoff Berrow 011000100110110 0010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011 http://slipperyhill.co.uk - http://4theweb.co.uk
John wrote:
On Sat, 01 Nov 2008 13:17:28 +0000, John <67vnue6o@knwfv wrote:
Here's the testing I did -
PAGE 1 CODE
$_SESSION[org_details] = $_POST['ORD_ORG'];
echo "1-$_SESSION[org_details]*<BR>";
$temp = 67;
$_SESSION[org_details1] = $temp;
echo "2-$temp-$_SESSION[org_details1]*<BR>";
$temp = $_POST['ORD_ORG']."1";
$_SESSION[org_details2] = $temp;
echo "3-$temp-$_SESSION[org_details2]*<BR>";
$temp = "adbr";
$_SESSION[org_details3] = $temp;
echo "4-$temp-$_SESSION[org_details3]*<BR>";
PAGE 1 RESULTS
1-Deptford Boys School*
2-67-67*
3-Deptford Boys School1-Deptford Boys School1*
4-adbr-adbr*
PAGE 2 CODE
echo
"--$_SESSION[org_details]-<BR>--$_SESSION[org_details1]-<BR>--$_SESSION[org_details2]-<BR>--$_SESSION[org_details3]";
PAGE 2 RESULTS
---
--67-
--1-
--adbr
(The strings inside the [] don't seem to make a difference)
John
You need braces around your array elements when using them in a
double-quoted string, and single quotes around the array indexes.
The correct way to do it would be:
echo
"--{$_SESSION['org_details']}-<BR>--{$_SESSION['org_details1']}-<BR>--{$_SESSION['org_details2']}-<BR>--{$_SESSION['org_details3']}";
Additionally, as NN indicated, ensure you have session_start() at the
beginning of EVERY page which uses session data.
And ensure you have these in the php.ini file on your development system:
display_errors= on
error_reporting =E_ALL
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== === This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: vivek |
last post by:
Do any of you guys have any idea what might be the reason for losing session
variables, i was working on a page where i had to stroe a array in a
session(trust me that was the only 'way' i could imagine doing it), and i am
losing the session variable, its just returning empty values...does any one
has any ideas?
|
by: Scott Lyon |
last post by:
I'm maintaining (read: I didn't write it, nor do I have the time to spend to
rewrite it) an application that is suddenly giving me grief.
The reason I say suddenly, is because we're in the process of transitioning
the server on which it runs from Microsoft Windows 2000 Server, to 2003
server (going from IIS 5 to IIS 6). This problem hasn't really occurred on
the 2000 server machine, but it's happening MUCH more on the new 2003 box
(not...
|
by: Joe Molloy |
last post by:
Hi,
This isn't a mission critical question but I thought I'dl throw it out there
for your feedback as it's a bit curious.
I have developed a shopping cart for an application I'm working on which is
loosely based on the e-commerce example in the quickstarts tutorial.
In the cart display I have provided functionality so that when a user clicks
on a product name a popup is opened with the full product details displayed.
|
by: fbwhite |
last post by:
I know this issue has been brought up many times, but I have tried many of
the solutions to no avail. I wanted to give my specific case to see if
someone could be of any help.
We are using the sessionstate inproc mode and users are randomly losing
their session. I do not believe it is happening across all users at one
time. It seems to happen to different users at different times, but I am
only going off heresay. The aspnet worker...
|
by: Reza Solouki |
last post by:
Hi,
I have a case where an item could have n subitems, so while doing the
alterations to the subitems, I need to keep the arraylist in session.
It was working fine in the development machine, till I put the code on a
test server, where I realized that it is losing the session information
everytime I do a request!
Here are the ways I manipulate the session subitem in general:
| |
by: Adrian Parker |
last post by:
We have a website that works everywhere but on a few PCs on this one site..
Asp.Net 1.1
Server = Windows 2003
Client = XP
In the web.config we use - cookieless="false"
in the browser settings they have "Always allow session cookies" set to true
When the browser connects to the website the first page sets a session
variable called "user_ref" to something and then calls another page. If on
|
by: Sukh |
last post by:
Hi,
I am using ASP.Net with C#. My application is using a control and when
control object is created my application set all the values to that
control. This also contain connection string values. Control add
connection string to session and rest values send to second application
in XML format. Second application does some processing and return back
to control. Here my control have to insert the return data to database
but when I try to...
|
by: jason.friesen |
last post by:
Hi Folks
I have a custom CMS built in classic ASP that is losing session variables. To wit, I can create a situation where my 'show all the set SVs' test page shows a different set of SVs on each refresh of the browser.
My test page goes a little something like this:
<h1>Checking Session Variables</h1>
<h2>Checking what session variables are set.</h2>
<p>
|
by: chromis |
last post by:
Hi there,
I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request scope. Application variables are then accessed in this manner Request.App.<Var>.
To begin with I had a simple functioning login system inside a subdirectory named admin, this subdirectory had it's own application.cfm, I wasn't sure whether to duplicate...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |