Jump to content

Php Session Issues


dpiearcy

Recommended Posts

I appreciate all the help in my last post and that issue has been resolved and working perfectly.

 

Now I'm in need of creating a session because I need the ID passed from one page to the next because I want to add to that row based upon that ID.

 

Here is the first page code:

 

(Someone told me how to insert code here but I forget.)

 

 

<?php

session_start();

$_SESSION['pid']=$_POST['pid'];

?>

 

Also have tried just a plain old $pid="$_POST['pid']; then declaring session as $pid.

 

on the second page I'm using:

 

 

<?php

session_start();

echo $_SESSION['pid'];

?>

 

(just using echo now to see if I'm getting the variable I'm wanting).

 

I get nothing. I'm not passing that ID and I REALLY need it.

 

Help?

Link to comment
Share on other sites

I have browsed this forum and noticed other threads dealing with sessions but didn't find a solution in any of those either.

 

I thought it could be my browser not accepting cookies (but it does accept the cookie I write for my admin section) so I tested in Chrome, Safari, Firefox, and IE (YUCK!) and am not passing that variable in any of them.

Link to comment
Share on other sites

I have browsed this forum and noticed other threads dealing with sessions but didn't find a solution in any of those either.

 

Never mind. I figured it out.

 

Be nice, and post the problem you found and your solution. Then the next guy (or gal) that searches the forum might find your solution and solve their own problem.

Link to comment
Share on other sites

Be nice, and post the problem you found and your solution. Then the next guy (or gal) that searches the forum might find your solution and solve their own problem.

 

Oops. Sorry about that David. I added a new post about sessions I titled something like just to help others dealing with sessions that detailed the problem I was having. Basically I was redirecting pages with a header change and then oddly I would lose my session variable. When I changed the way I redirected with a print the problem went away and I was able to receive my session variables.

 

Still haven't figured out why I lost them with the header redirect but after I had a solution I moved on from there but it's something I'm going to look into in the future. After this project is finished perhaps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.