Hi,
Can anyone help me with pb. I'm running this script to sold many products at once but it's not working as I intended. This is the script php
include_once("../library/config.inc.php");
include_once(COMMON);
include_once(TEMPLATE);
$template=new Template;
$errors=$vars=array();
session_start();
$d = db_c();
if (!logged_in()) {
header("Location:".PHP_LOGIN);
}
$products=seller_product_list();
if(isset($_POST["sold"])){
foreach($products["products"] as $k=>$v){
if(isset($_POST["product_".$v["id"]])){
$s = "UPDATE Products SET Purchased = \"Yes\" WHERE ID = ".$v["id"];
db_q($s);
header("Location: ".PHP_SELL_PROD_LIST);
exit;
}
}
}
if I do print_r($_POST) this is what I get:
Array ( [product_3] => 1 [product_20] => 1 [product_28] => 1 [sold] => Remove )
That means the products are selected
on the html side I'm using smarty like this
<td class="pfs"><input type ="checkbox" name="product_{$seller_product_list.products[products_line].id}" value="1" /></td>
this is only a part of the html and at the end of the template I'm using this button
<input type="submit" name="sold" value="Remove" class="form_button" />