> i am writing a shopping site for training (just out of interest).
>
> When a user clicks "add to basket" i want to check whether an item with
> that id is already in my session ($ALCOHOLE["items"]), if so, redirect
> them the the view_cart page, if not then append it to the
> $ALCOHOLE["items"] array as $key => $value pairs.
>
> I have played around with all sorts of loops and sorts all day but still
> cannot get it sorted. Can anyone suggest where I am going wrong or has
> anyone got a better method they would care to suggest?

Couldn't you use in_array() on your $ALCOHOLE array so see if your "item" is
in it?

If it is, then use header() to redirect, or append the value.

What's the format of your "item" variable and maybe we can help more.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to