This is how my session reads:

Array
(
    [pstloggedin] => blah
    [userID] => blah
    [email] => blah
    [fname] => blah
    [lname] => blah
    [phone] => blah
    [cart] => Array
        (
            [0] => Array
                (
                    [team] => 2137
                    [tournament] => 24577
                    [gatefee] => yes
                    [cost] => 800
                    [sdate] => 2010-06-03
                    [edate] => 2010-06-06
                )

            [1] => Array
                (
                    [team] => 2137
                    [tournament] => 24600
                    [gatefee] => 
                    [cost] => 675
                    [sdate] => 2010-06-10
                    [edate] => 2010-06-13
                )

        )
)

When a user goes to add another event to their cart, I want to check this session array to make sure this event isnt already in their cart.

I need to make sure [team] and [tournament] are not already inside one of these arrays above. I get the team and tournament ids from a GET Statement upon adding to the cart.

Any help would be great, thanks.

if(in_array( $_GET['value'], $array))
{
     // Do Something
}

Where does it get the info for $array from?

Example:

$array = array('this', 'that', 'the_other');

if(in_array('this', $array))
{
     echo 'True';
} else { echo 'False'; }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.