[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

Session arrays

I'm trying to pass a SESSION array to another page

I know the code is wrong

I know the count for each variable.
 
This is what I have.

$SESSION['Right_Bldg']["SEQ"] = $ROW['SEQ'];

I'm passing the array count as a session variable, so I'm not worried about that.  The problem is on the first page.

Thanks
Glenn
0
breeze351
Asked:
breeze351
  • 4
  • 3
  • 2
  • +1
7 Solutions
 
Marco GasiFreelancerCommented:
Sorry, but I don't understand your problem.
The line:
$SESSION['Right_Bldg']["SEQ"] = $ROW['SEQ'];

Open in new window

is not necessarily wrong. But in the first page youi probably have to get the value $ROW['SEQ'] before to put it in the $_SESSION array. What $ROW['SEQ'] represents? Where it comes from?
We need more infos and more code to help you :-)
0
 
Ray PaseurCommented:
$SESSION != $_SESSION (check the name of the variable)

Here is how to use PHP sessions.  See the part captioned How to Write Your Code
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11909-PHP-Sessions-Simpler-Than-You-May-Think.html
0
 
Ray PaseurCommented:
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Marco GasiFreelancerCommented:
Lol. Sometimes I don't see the baobab just in font of me!
0
 
Dave BaldwinFixer of ProblemsCommented:
And of course...  you must have session_start() at the top of Each and Every page in the session.  http://us1.php.net/manual/en/function.session-start.php
0
 
breeze351Author Commented:
My bad!!!!

I got most of it.  Idiot partner used $SESSION instead of $_SESSION in the first page!!!!

My problem is on the 2nd page now
I'm getting the following error with this code:

echo "lcount - ";
echo $_SESSION['Left_Bldg_Count'];

Notice: Undefined index: Left_Bldg_Count in /home/mrbreeze/public_html/chris/Walk_Map_Fred_PDF.php on line 10

I've displayed $_SESSION['Left_Bldg_Count'] on the 1st page.
0
 
Marco GasiFreelancerCommented:
Have you session_start() at the top of the page? Both pages?
0
 
breeze351Author Commented:
Yup.  Here's the inclusion that's at the top of every page:
<?php
session_start();
header("Cache-control: private");
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
0
 
Marco GasiFreelancerCommented:
Try to put this at the top of the page, after session_start():
echo "<pre>";
var_dump($_SESSION);
echo "</pre>";

Open in new window

This will print out the whole $_SESSION array so you can check if all expected values are present. var_dump is usually a good friend. :-)
0
 
breeze351Author Commented:
Thanks for the help
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now