hi, i had a problem with my cart values, i am doing like this

choose product and select the value of quantity and then clickic the submit button of add to cart as:

it goes as :

http://localhost/PPP_Cart/scart.php?quantity=7&pd=3

i am using the following as:

<?php 
if (@$pd)
{
$cart[$pd]=$quantity;
}
displaycart();
?>

$cart is registered as an array if cart not existed...

then the fuction is called as:

function displaycart()
{
global $cart, $totalprice;
echo "<table>";
echo "<tr><td>Product ID</td><td>Product Name</td><td>Quantity</td><td>Total Cost</td></tr>";
$items=0;
$totalprice=0.00;
foreach (@$cart as $poneid => $qty)
{
$items+=qty;
$query="SELECT * FROM catalog WHERE id='".$_REQUEST["poneid"]."'";
$result=mysql_query($query);
while ($fetchproducts=mysql_fetch_array($result))
{
echo $fetchproducts['cost'];
echo $fetchproducts['p_name'];
}

does not show up the cart values, i do not what is wrong...

it always show 0 with 0 price, i try to select the quantity and id but something is wrong...............

i have also using he $cart script as:

<?php
if(!session_is_registered("cart"))
{
$cart=array();
session_register("cart");
}
?>

but not working with the above code,

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.