Jump to content

Sessioning an array?


Spreegem

Recommended Posts

I am trying to sesssion an array, and then get some data from the array after some form data is submitted to another page, but when I try and get data from it, the array is blank. Is it even possible to session arrays, or am I doing something wrong in my code?

[code]
//From page 1
$_SESSION['h_class'] = $class_array;

//From Page 2
$class_array = $_SESSION['h_class'];
$h_class = $class_array["$num"];
[/code]
Link to comment
https://forums.phpfreaks.com/topic/12022-sessioning-an-array/
Share on other sites

That looks ok, except you really don't need the double quotes in this line:[code]<?php $h_class = $class_array["$num"]; ?>[/code]

Do you have a "session_start()" line at the start of each script?
If you put the line [code]<?php echo '<pre>' . print_r($_SESSION,true) . '</pre>'; ?>[/code] right after the sessions_start(), what displays?

Ken
Link to comment
https://forums.phpfreaks.com/topic/12022-sessioning-an-array/#findComment-45726
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.