hyster Posted February 16, 2011 Share Posted February 16, 2011 $seat_s is a $var that can have multiple values depending on a form in a previous page. this code works fine as is, but i need to pass the array into a 3rd page. i have no idea how to do this from the code below. ive tried passing the array straight into a _post then _get on the next page but that only holds the 1st value and not all of them. suggestions please.... thanks <?php $seat_s = $_POST['seats']; foreach($_POST['seats'] AS $seat) { $rowId = substr($seat, 0, 1); $columnId = substr($seat, 1); echo $rowId . $columnId . ", "; } ?> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 16, 2011 Share Posted February 16, 2011 Is there any reason you aren't using $_SESSION vars for this, or is that an option? Quote Link to comment Share on other sites More sharing options...
hyster Posted February 16, 2011 Author Share Posted February 16, 2011 ive never used sessions outside of a log in script so didnt know that i could. do you think this is the best way? if so can you point me in the correct direction pls Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 16, 2011 Share Posted February 16, 2011 I'd at least consider it. All you need to do is make sure you've called session_start() before any output has been sent, then you can use a $_SESSION var like any other variable. <?php session_start(); $_SESSION['post_data_array'] = $_POST['array_element']; ?> Some other script . . . <?php session_start(); print_r($_SESSION['post_data_array']); ?> Quote Link to comment Share on other sites More sharing options...
hyster Posted February 16, 2011 Author Share Posted February 16, 2011 thanks. that passed and echo the array. next problem is how do i get the output into a format i can use in a sql query? atm the format is [1]=>value1 [2]=>value2 [13]=>value3 i tried echo $_SESSION['post_data_array[1]' put the value returns as array. what i need is value1 value2 value3 Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 16, 2011 Share Posted February 16, 2011 $_SESSION['post_data_array'][0] should work . . . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.