Jump to content

Adding an add to cart button to my variables


mikebyrne

Recommended Posts

Im displaying my product info on this page but I want to add an "Add to Cart" button. The static code for the button is

 

<a href="cart.php?action=add&id=22"><img src="Pictures/cdw_tdev_atc_v1_red.gif" class="cartimg" border="0" title="WESTLIFE - Love Album, The - Add to cart!" alt="WESTLIFE - Love Album, The - Add to cart!" height="16" width="60"></a>

 

How can i aply this with use of the varibles below?

 

<?php
include("adminconnect.php");
$id = $_GET['id'];
$sql = "SELECT * FROM product WHERE ProductNo = '$id'";
$res = mysql_query($sql) or die(mysql_error());
// Since you are getting only one row no neew to loop
$row = mysql_fetch_assoc($res);
// now just echo all your fields below and format it the way you like
echo "Title:  ".$row['ProductName']."</a>\n<br> <img src=\"".$row['Image']."\"></img>\n<br> Price ".$row['Price']."\n<br>
    Description: ".$row['Description']."\n<br>";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.