Re: Session variables are lost, disappear from page to page
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Thu, 06 Mar 2008 17:57:22 -0500
fSaint wrote:
On Mar 6, 1:55 pm, Saint <ianwal...@xxxxxxxxx> wrote:>On Mar 6, 1:40 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
Saint wrote:My Server Enivronment:I doubt it's a PHP but. But you haven't posted your code, so we have no
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.
idea what's happening.
<snip lots of code)
> I know its a mess, I rewrote the code a million times cuz I couldn't
> figure out what was wrong, so this isnt even the original version, But
> it should still work.
>
First of all, please don't top post. This group uses bottom or interleaved posting as a standard.
The code looks OK, although it seems you aren't passing some values to the page, i.e. $_POST['criteria'] and $_POST['stable']. BTW, rather than just checking for <> '', you should also see if it's set in the first place, i.e.
if (isset($_POST['criteria']) && $_POST['criteria'] ,. '') ...
As to your problem - first of all, in deleterec.php, is the <?php the very first thing in your page? That is, no blank lines, no white spaces, etc.?
Next, what's your error settings? For debugging, in your php.ini file you should have:
error_reporting = E_ALL
display_errors = On
If this is on a shared host, you can do this in your code with
error_reporting(E_ALL);
ini_set('display_errors', '1');
You need these as the very first things after your <?php in each file.
But since you indicate your edit pages get the $_SESSION values but your delete pages don't, I suspect the code in here is OK. It's a bit hard to tell with all the javascript, though.
If the suggestions I have above don't find anything, can you compress it down to just the very minimum required. No javascript, etc. That makes things a lot easier to troubleshoot.
And axlq is correct - I don't see a need for his code, especially since this works sometimes. And it shouldn't be required.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- References:
- Session variables are lost, disappear from page to page
- From: Saint
- Re: Session variables are lost, disappear from page to page
- From: Jerry Stuckle
- Re: Session variables are lost, disappear from page to page
- From: Saint
- Re: Session variables are lost, disappear from page to page
- From: Saint
- Session variables are lost, disappear from page to page
- Prev by Date: Re: Menu voice of a form is not transmitted
- Next by Date: PHP Cancel Script Execution
- Previous by thread: Re: Session variables are lost, disappear from page to page
- Next by thread: Re: Session variables are lost, disappear from page to page
- Index(es):
Relevant Pages
|
|