Forum Moderators: coopster
this won't work, you can't echo an array or object like that. I assume all of this info gets output as html? If so the values that are output to the browser can be written into the form individually and submitted but I am not 100% sure if I completely understand.
As an aside want a quick piece of shorthand?
$index = $index + 1;
is the same as
$index++; // I use this for counters
and the same as
$index += 1; // I use this to add int values to themselves
for strings you can do
$strvar .= "more strings";
e.g.
<input type="hidden" name="user[firstname]" value="Graham">
<input type="hidden" name="user[lastname]" value="Stewart">
<input type="hidden" name="user[gender]" value="M">
The submit page will now have access to the array as $_POST['user'] (or $_GET['user'] if you use a GET method on the form).
And of course you can do multi-dimensional arrays like this too..
e.g.
<input type="hidden" name="product[1][name]" value="Widget">
<input type="hidden" name="product[2][name]" value="Grommit">
An alternative way would be, to generate any only pass a session_id to the user. Then in your db/flatfile you save the data associated with that session_id.