I am trying to take a set of two form fields that go into an array that then get saved into a session. I then want to take the array from the session on another page and put it into an ArrayData object that then goes into a DataObjectSet. I want to then render this into a table in my template. The amount of values in the array is dynamic. If the key were always the same I could see what to do, but with the unknown keys and values I am stuck.
I have looked all around and haven't been able to get anything to work. So a simplified version of what I would like to do would be like this:
//Page one
$color = Session::get('Color');
$number = Session::get('Number');
$item = array($color=>$number);
array_push($order,$item);
Session::set('order',$order);
//Page two
function getItems() {
$items = Session::get('order');
$itemData = new DataObjectSet();
$itemData->push( new ArrayData($items) );
return $itemData;
}
//Template
<% control getItems %>
// I am not sure what values or methods I use here
<tr><td>$key</td><td>$value</td></tr>
<% end_control %>
}
So I may be way off base here, but this was the best I could figure out to do, seems difficult for an easy job. The concept I want here would be the same as taking form fields and grabbing them on another page through a POST then printing those values out on another page.