at the moment i have 4 product pages.....
each product on these pages has an "ADD" button next to it, "'<a href ="cart.php?action=addprod&prodcode='.$prod_id.' ">Add</a>'; ?>" which then takes the products unique prod_id and transfers it to the cart.
the on my cart page i have following.
<?session_start();?>[/b] // At the top of the page.
followed by:
[b]if ( ( isset( $_REQUEST['action'] ) ) && ( isset( $_REQUEST['prodcode'] ) ) )
{
$code = $_REQUEST['prodcode'];
if ( $_REQUEST['action'] == "addprod" )
{
$_SESSION['cart'][ $code ] = array(
'prodcode' => $code,
'quantity' => 1,
);
}
}
if ( $_REQUEST['action'] == "empty" )
session_unset();
echo "<pre>\n";
print_r( $_SESSION );
echo "</pre>\n";
?>
This does work, it displays the prod_id which it got from the product page and also the quantity of 1, (which i hard coded)
my problem is: how could i connect this to my database to get te rest of the product info?
and how can i make the cart look better, as because i am currently printing the array it looks like this:
Array ( [cart] => Array ( [RUG254CD] => Array ( [prodcode] => RUG254CD [quantity] => 1 ) ) )


Help
This topic is locked
MultiQuote










