Marc de Winter wrote:
> The ordering proces will be a form with multiple pages. The visitor will be
> guided through the menu in 5 steps. Step 1 being the pizzas, step 2 the
> pastas, and so on.
> On each page there is always the possibility to add an "side-order" to their
> order. So, on the right is always the same list of side-orders.
>
> I am using a script called fieldforwarder.php (see this page for the script:
> http://www.zend.com/zend/spotlight/c...7.php#Heading9)
>
I don't have experience of the Zend script you're referring to, but this
sounds to me like a classic situation for an array session variable.
What you're describing is a shopping cart, really. I would suggest
registering a session variable called somthing like $order, and adding
things to it. It'll be an array (arbitrarily deep), so the order
information could be stored in that. For example the array might contain
(untested):
$_SESSION['order'] = array(
pizza => array (type => 'quattro formaggi', quantity => 1),
pasta => array (item => 'carbonara', quantity => 2),
italianchefsalad_junior => array (quantity => 1)
)
etc, etc.
That way, you could always refer to the session array $order to find out
what was on the buyers list (untested):
foreach ($_SESSION['order'] as $dish => $details) {
echo $dish.":<br>";
foreach ($details as $detail => $information) {
echo $detail.": ".$information."<br>";
}
echo "<br>";
}
this will give you something like:
pizza:
type: quattro formaggi
quantity: 1
pasta:
type: carbonara
quantity: 2
italianchefsalad_junior:
quantity: 1
Or you could find the quantity of italianchefsalad_junior at
$_SESSION['order']['italianchefsalad_junior']['quantity'].
Clearly the data structure needs to be carefully thought through, and my
suggested one is probably totally inappropriate for your application,
but you might get the idea.
For more info on PHP sessions and session variables, the PHP website is
essential reading (UK mirrors given):
http://uk2.php.net/manual/en/function.session-start.php
http://uk2.php.net/manual/en/functio...n-register.php
Ed