function writeShoppingCartup() {
$cart = $_SESSION['cart'];
if (!$cart) {
return '<img src="../../media/cart.jpg"> <br /> Cosul meu (Gol)';
} else {
// Parse the cart session asizeiable
$items = explode(',',$cart);
$s = (count($items) > 1) ? 'e':'';
return '<img src="../../media/cart.jpg">
<br /><a href="#BASE_URL#ViewCard/">Cosul meu (' .count($items).')</a>';
}
}
function showCart() {
global $db;
$cart = $_SESSION['cart'];
$output[] = '<div align="center"><table cellpadding="1" cellspacing="1" bgcolor="#666666" width="400">';
$output[] = '<tr bgcolor="#FFFFFF" valign="middle">';
$output[] = '<td width="70" align="center">Titlu</td>';
$output[] = '<td width="90" align="center">Imagine </td>';
$output[] = '<td width="60" align="center">Pret</td>';
$output[] = '<td align="center">Sterge Produs</td>';
$total += $price * $qty;
$output[] = '</tr>';
$output[] = '</table>';
if ($cart) {
$items = explode(',',$cart);
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
}
$output[] = '<form action="http://www.sprayart.info/new/sprayart.php"><div align="center" name="trimite" id="trimite"><table width="400">';
foreach ($contents as $id=>$qty) {
$sql = 'SELECT * FROM com_images WHERE id = '.$id;
$result = $db->query($sql);
$row = $result->fetch();
extract($row);
$output[] = '<tr bgcolor="#FFFFFF">';
$output[] = '<td width="70">
[THIS IS PROBLEM PHP] <input type="hidden" name="title[]" value="'.$title.'" size="5" maxlength="5" />
<input type="text" value="'.$title.'" size="5" maxlength="5" disabled="disabled" /></td>';
$output[] = '<td width="90" align="center" valign="middle"><img src=../../'.$thumbnail.'> </td>';
$output[] = '<td width="60" align="center">'.$price.'</td>';
$output[] = '<td ></td>';
$total += $price * $qty;
$output[] = '<td width="50"><a href="cart.php?action=delete&id='.$id.'" class="r"><img src="../../media/sterge.jpg"></a></td>';
$output[] = '</tr>';
}
$output[] = '</table>';
$output[] = '<hr>';
$output[] = '<p align="right">Total De plata: <strong>'.$total.' RON</strong></p></div>';
Ok i will expend the issue !!!
This is a function that add items in my shopping cart the problem is that this generate a multiple row table and whe i try to $_GET; $_POST['title'] the value of $_GET,POST['title'] should be an array but is NULL, and i can figure out why ... i try
"foreach($_POST['test'] as $val) {
echo $val .'<br >';
}"
but i get this
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\SprayART\includes\functions.inc.php on line 113
so when i use this
if(is_null($_POST['title']))
{
echo "true";
}else{ echo "false";}
I get the " true" value ... so this is my problem $_POST['title'] IS NOT AN ARRAY
my question is WHY ???