Spreegem Posted June 14, 2006 Share Posted June 14, 2006 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 More sharing options...
kenrbnsn Posted June 14, 2006 Share Posted June 14, 2006 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 More sharing options...
Spreegem Posted June 15, 2006 Author Share Posted June 15, 2006 Thanks a bunch, but it was actually working from the beginning, its just where I was trying to use it the if was incorrect and so I didnt think it was working even though it was. Thank you for your help! Link to comment https://forums.phpfreaks.com/topic/12022-sessioning-an-array/#findComment-45774 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.