Hi,
I have 2 table : Product and Cart.
In Product table I have 4 fields: ID, Name, Price and another ID with alias BUY(that should be a button).
In Cart table I have 3 fields: ID, Product, Price.
I need to add a custom code for BUY (View as Custom) in visual editor to add Name and Price from the product to Cart table ( Product and Price fields) and redirect to Cart_list.
I tried these codes:
global $conn;
$strSQLInsert = "insert into _cart (Product, Price) values (".$data["Product"].", ".$data["Price"].")";
db_exec($strSQLInsert,$conn);
$value = "<a href=\"Cart_list.php\"><IMG src=images/Cart.png></a>";
and
global $conn;
$strSQLInsert = "insert into _cart (Product, Price) values (".$_SESSION["Product"].", ".$_SESSION["Price"].")";
db_exec($strSQLInsert,$conn);
$value = "<a href=\"Cart_list.php\"><IMG src=images/Cart.png></a>";
but without the desired result.
Please help me with the correct code for what I need to do.
Thank you in advance !