here's my canned.php
<?php
$conn=odbc_connect('firebird','SYSDBA','masterkey');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM CANNED";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<table class='tbcanned' cellpadding='5' cellspacing='5'><tr>";
echo "<th>PRODUCT</th>";
echo "<th>QUANTITY</th>";
echo "<th>PRICE</th>";
echo "<th>DESCRIPTION</th>";
echo "<th>ADD TO CART</th></tr>";
$i=1;
while (odbc_fetch_row($rs))
{
$id=odbc_result($rs,"ID");
$name=odbc_result($rs,"NAME");
$quantity=odbc_result($rs,"QUANTITY");
$price=odbc_result($rs,"PRICE");
$description=odbc_result($rs,"DESCRIPTION");
echo "<tr><td style='background-image:url(../_image/tealGradient.png)'><input type='text' name=name value='$name' class='name'>";
echo "<br";
echo "<tr><td><input type='text' value=0 name='quantity[$i]' class='quantity'>";
echo "<br";
echo "<tr><td><input type='text' value='$price' name='price[]' class='price'>";
echo "<br";
echo "<tr><td>$description";
echo "<br";
echo "<tr><td><input type='checkbox' name='checkbox[]' value='$name'>";
echo "<br";
echo "</table>";
$i++;
}
odbc_close($conn);
echo "</table>";
?>
heres my cart.php
<?php
$name = $_POST['name'];
$quantity = $_POST['quantity'];
$checkbox = $_POST['checkbox'];
$price = $_POST['price'];
if(is_array($checkbox)){
foreach($checkbox as $key=>$value){
echo "$value.<br/>";
echo "$price";
}
if (is_array($quantity)){
foreach($quantity as $key=>$item_qty){
$item_qty = intval($item_qty);
if($item_qty>0){
echo "$item_qty.<br/>";
}
}
}
}
?>
i just want to display the price of checkbox were selected and make a total of it by
$total = $price * $quantity
echo $total
can someone help me with this ty in advance.