Hello
I have a form for a shoping cart that input even the value 0. How can i program php to not insert into table the products
$row['Denumire_produs']
where the quantyti=$cantitate is 0
Here is the form input
$query="select*from produse";
?> <form action="cumpar.php" method="post">
<td><input type="text" name="cantitate[]" value=" " size="1"/></td></tr>
<input type="hidden" name="Denumire_produs[]" value="<?php echo $row['Denumire_produs'];?>"/>
<input type="hidden" name="id_produs[]" value="<?php echo $row['id_produs'];?>"/>
<input type="hidden" name="Pret[]" value="<?php echo $row['Pret'];?>"/><?php ;}//Navigaton?>
AND HERE IS THE
QUERY FOR ARRAY
$numrows=mysql_num_rows($results);
if ($numrows>0){
$cantitate=($_POST['cantitate']);
$denumire=($_POST['Denumire_produs']);
$id_produs=($_POST['id_produs']);
$pret=($_POST['Pret']);
//extrage un array ---foarte tare bolean
for($i=0;$i<$limit;$i++){
$queryi="insert into livrari_luni
(user_id,
id_programare,
id_produs,
denumire_produs,
Pret,
cantitate
)values(
'". $userid . "',
'". $id_prog . "',
'". $id_produs[$i] ."',
'". $denumire[$i] . "',
'". $pret[$i] . "',
'". $cantitate [$i] ."')";
$resulti = mysql_query($queryi)
or die (mysql_error);
thanks in advance