How do I add to an array in PHP?
<p>I'm doing the following but it doesn't work. it only has 1 item in the array no matter how many i add</p>

<p>can someone tell me what i'm doing wrong</p>

<pre><code>session_start();

$pid = mysql_real_escape_string(trim($_GET["pid"]));
$price = mysql_real_escape_string(trim($_GET["price"]));
$quantity = mysql_real_escape_string(trim($_GET["quantity"]));

if (!isset($_SESSION['cart'])) {
    $_SESSION['cart'] = array();

    $_SESSION['cart']['pid'] = $pid;
    $_SESSION['cart']['total_price'] = $price;
    $_SESSION['cart']['total_items'] = $quantity;

}else{
    $_SESSION['cart']['pid'] = $pid;
    $_SESSION['total_price'] += $price;
    $_SESSION['total_items']  += $quantity;
}
</code></pre>
