By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 1,824 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

Session variables are lost, disappear from page to page

P: n/a
My Server Enivronment:

MS Windows Server 2003
Standard Edition, Service Pack 1
(running as a VM on a Intel Xeon server)

IIS running on Port 80
Apache 2.0.63 running on port 8080
PHP 5.2.5
So I have a script that selects a bunch of records from a database,
each record displayed with a checkbox. I have a drop down menu that
says 'edit records' and 'delete records'. When the user selects 'edit
records' the values of the checkboxes are stored in a session array
and the user is redirected to another page to edit the records.

This part of the application works fine.

When the user selects 'delete records' the same things happens except
their directed to a different page. But when the user gets there, for
some reason, the data in the session array is gone.

I tried this script on my shared hosting (running Linux) and the
script worked fine.

I tried to use a javascript redirect instead of header() because I saw
that there was a problem with session variables using it back in PHP4,
but that didn't work.

I tried putting the 'delete recrods' code in the same page as the drop
down menu form, and it worked fine. So it's definitely an issue going
from page to page.

But the strangest thing about this, is that the session variables
aren't lost when I try to edit the records, only when I try to delete
records. In fact, another strange thing about this is that this script
worked fine for a while at first, then all of a sudden it stopped
working, like I had changed the code, but I hadn't.

I think it's a PHP bug, but PHP support won't acknowledge it as a bug,
and I can't change the server environment.
Mar 6 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Saint wrote:
My Server Enivronment:

MS Windows Server 2003
Standard Edition, Service Pack 1
(running as a VM on a Intel Xeon server)

IIS running on Port 80
Apache 2.0.63 running on port 8080
PHP 5.2.5
So I have a script that selects a bunch of records from a database,
each record displayed with a checkbox. I have a drop down menu that
says 'edit records' and 'delete records'. When the user selects 'edit
records' the values of the checkboxes are stored in a session array
and the user is redirected to another page to edit the records.

This part of the application works fine.

When the user selects 'delete records' the same things happens except
their directed to a different page. But when the user gets there, for
some reason, the data in the session array is gone.

I tried this script on my shared hosting (running Linux) and the
script worked fine.

I tried to use a javascript redirect instead of header() because I saw
that there was a problem with session variables using it back in PHP4,
but that didn't work.

I tried putting the 'delete recrods' code in the same page as the drop
down menu form, and it worked fine. So it's definitely an issue going
from page to page.

But the strangest thing about this, is that the session variables
aren't lost when I try to edit the records, only when I try to delete
records. In fact, another strange thing about this is that this script
worked fine for a while at first, then all of a sudden it stopped
working, like I had changed the code, but I hadn't.

I think it's a PHP bug, but PHP support won't acknowledge it as a bug,
and I can't change the server environment.
I doubt it's a PHP but. But you haven't posted your code, so we have no
idea what's happening.

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

Mar 6 '08 #2

P: n/a
In article <21**********************************@60g2000hsy.g ooglegroups.com>,
Saint <ia*******@gmail.comwrote:
>My Server Enivronment:

MS Windows Server 2003
Standard Edition, Service Pack 1
(running as a VM on a Intel Xeon server)

IIS running on Port 80
Apache 2.0.63 running on port 8080
PHP 5.2.5

[snip]

I tried this script on my shared hosting (running Linux) and the
script worked fine.
OK. Nothing wrong with your code or PHP, then.
>But the strangest thing about this, is that the session variables
aren't lost when I try to edit the records, only when I try to delete
records. In fact, another strange thing about this is that this script
worked fine for a while at first, then all of a sudden it stopped
working, like I had changed the code, but I hadn't.

I think it's a PHP bug, but PHP support won't acknowledge it as a bug,
and I can't change the server environment.
Sounds to me like a server bug more than a PHP bug, especially since
it works fine under Linux.

I don't know if it will work, but it helped me to do the following at
the start of my code:

session_save_path($my_session_path);
session_name('login_settings'); // or any other name you want
session_start();
if (session_id() == 'deleted') session_regenerate_id(true);

Mr. Stuckle may come along and argue that the above isn't necessary,
but that isn't true for everyone's case.

-A
Mar 6 '08 #3

P: n/a
Greetings, Saint.
In reply to Your message dated Friday, March 7, 2008, 23:11:19,
I restarted Apache when I turned error reporting on and it started
working again.
I guess the world will never know?
I think there may be some issues with Your browser.
And please, don't top-post.
--
Sincerely Yours, AnrDaemon <an*******@freemail.ru>

Mar 8 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.