Problem pulling data from record set
When I add a dynamic add to cart button, I don't get the information for the data set for my shopping cart.
First I attached the recordset1 to the product result page:
Here is the code that I set the filter for form variable = ID: When I test it with ID= 101 it pulls up the information correctly.
<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php require_once('Connections/bearpawwdcostdb.php'); ?>
<?php
$eCart1->GetContent();
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_Recordset1 = "-1";
if (isset($_POST['ID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['ID'] : addslashes($_POST['ID']);
}
mysql_select_db($database_bearpawwdcostdb, $bearpawwdcostdb);
$query_Recordset1 = sprintf("SELECT * FROM producttable1 WHERE ID = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $bearpawwdcostdb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?>
Next I insert the dynamic add to cart button with the ID value = 101
Here is the add to cart button cord:
<form name="eCart1_1_ATC_<?php echo $row_Recordset1["101"]; ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="eCart1_1_ID_Add" value="<?php echo $row_Recordset1["101"]; ?>" >
<input type="text" name="eCart1_1_Quantity_Add" value="1" size="4" >
<input type="image" src="WA_eCart/Images/Deep Jungle/Btn2_EN_addtocart.gif" border="0" class="eC_ImageButton" value="Add to Cart" name="eCart1_1_ATC">
</form>
But when I run the page and try to add the 101 product to my cart, nothing happens.
To test the page and shopping cart links, I set it up as a static button with all the information and the cart worked perfectly.
So why won't the dynamic add to cart button read the info from my record set and insert it into my shopping cart.