View Full Version : POSTing multidimensional arrays
04-08-2004, 05:38 PM
when I create the following multidimensional array:
$meetings[$query_data['meeting_id']]=array('note' => $query_data['note'], 'meeting_date' => $query_data['meeting_date']);
And I do need to POST it with a submit button to another page how do I do that? Tried the following it didnt work:
<input type=hidden name=country value="<?php echo $meetings; ?>" >
04-08-2004, 05:40 PM
Possibly check out implode() (http://www.php.net/manual/en/function.implode.php) and explode() (http://www.php.net/manual/en/function.explode.php) ???
i think you indeed need to drag it along as a string so you'll need the implode() to create it and the explode() to turn it back into an array, although i'm not sure at all it'll work just like that with an associated array. (I'm fairly comfident it wount work.) You'll need to do some extra processing to turn it into a string with two delimiters (one for the elements and one to devide the key and value) and to recreate the array.
Can't you store the array in a sessionvariable ?
04-08-2004, 06:18 PM
how would I create the array into a session variable - if it is an option its OK,
04-08-2004, 06:39 PM
$_SESSION['array'] = array(15, 35, 34, 16, 29); I don't know how a multidimensional array would go, but i'm sure it is possible.
yes, you just do your
$_SESSION['newarray'] = $yourarray; // doesn't realy matter if it's an associate or mutidiminsional.
To proces it, best first have a
$myarray = $_SESSION['newarray'] ;
... your processingcode
$_SESSION['newarray'] = $myarray ;
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.