still not working
hi jason
thanks for your replay but after i made the changes you asked i still have the same problem.
even if i don't tick a check box and click add to cart it adds all products on the list to cart.
here is my modified code.
---------------------------
<?php require_once('Connections/conn.php'); ?>
<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?>
<?php
$eCart1->GetContent();
?>
<?php
//WA Database Search Include
require_once("WADbSearch/HelperPHP.php");
?>
<?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;
}
}
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT * FROM comp";
setQueryBuilderSource($query_Recordset1,$WADbSearch1,false);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: Recordset1;
//Searchpage: ;
//Form: ;
$WADbSearch1_DefaultWhere = "0 != 0";
if (!session_id()) session_start();
if (isset($_POST["ATCCheck"])) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
//comparison list additions
$WADbSearch1->addComparisonFromList("id","ATCCheck","AND","=",1);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_wa"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_wa"]) && $_SESSION["WADbSearch1_wa"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_wa"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>
<?php
// WA eCart Get Info From RS
if (isset($_POST["AddToCartButton_x"]) && isset($totalRows_Recordset1) && $totalRows_Recordset1 > 0) {
$Redirect_redirStr="";
do {
$eCart1_itemID = floatval("".$row_Recordset1['id'] ."");
$eCart1_itemName = "".$row_Recordset1['name'] ."";
$eCart1_itemDescription = "";
$eCart1_itemWeight = floatval("0");
$eCart1_itemQuantity = floatval("1");
$eCart1_itemPrice = floatval("0");
$eCart1->AddToCart(1, "", $eCart1_itemID, $eCart1_itemName, $eCart1_itemDescription, $eCart1_itemWeight, $eCart1_itemQuantity, $eCart1_itemPrice);
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
if ($Redirect_redirStr != "") {
$eCart1->redirStr = $Redirect_redirStr;
}
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
-----------------------
and my form is
<form method="post" id="add_to_cart">
<table width="100%" border="0">
<tr>
<td width="17%"><input type="image" name="AddToCartButton" id="AddToCartButton" src="WA_eCart/Images/Slate/Btn4_EN_addtocart.gif" /></td>
<td width="28%"> </td>
<td width="5%"> </td>
<td width="17%"> </td>
<td width="33%"> </td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['name']; ?></td>
<td width="28%"> </td>
<td width="5%"><input name="ATCCheck[]" type="checkbox" id="ATCCheck" value="<?php echo $row_Recordset1['id']; ?>" /></td>
<td width="17%"> </td>
<td width="33%"> </td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<tr>
<td> </td>
<td width="28%"> </td>
<td width="5%"> </td>
<td width="17%"> </td>
<td width="33%"> </td>
</tr>
</table>
<br />
<br />
</form>
------------------------
if i move the Data assist code before the record set i get no result at all.
looking forward to a solution
cheers