Increase the quantity of a product

0

<div class="button2">

<?php

while($row1 = sqlsrv_fetch_array($result1, SQLSRV_FETCH_NUMERIC)) {
  $resultado1 = $row1[1];
  $resultado2 = $row1[0];
  $id1[$i] = $resultado2;
  $nome[$i] = $resultado1;
?>

<form action="" method="post">
  <input type="submit" class="bt5" value="<?php echo $resultado1;?>" name="botoes">
</form>

<?php
  $i = $i + 1;
}
?>
</div>

<?php
}

else {
  header("Location: index.php");
}

if(isset($_POST["botoes"])){
  $cookiebotao_value = $_POST["botoes"];
  setcookie("erbonsoftwarebotao", $cookiebotao_value);
  setcookie("erbonsoftwarerefresh", 1);
  header("Location: banquetes.php?id=$id");
}

if(isset($_POST["botoes2"])){
  $contagem = $_COOKIE["erbonsoftwarecontagem"];
  $contagem = $contagem + 1; 
  setcookie("erbonsoftwarecontagem", $contagem);
  $cookiebotao2_value = $_POST["botoes2"];
  setcookie("erbonsoftwarenome$contagem", $cookiebotao2_value);
  setcookie("erbonsoftwarerefresh", 1);
  header("Location: banquetes.php?id=$id");
}
?>
<div class="button3">
<?php
  $repeticoes = "";
  setcookie("erbonsoftwarerepeticoes", "");
	
  if(isset($_COOKIE["erbonsoftwarerefresh"]) && $_COOKIE["erbonsoftwarerefresh"] == 1) {
  if(isset($_COOKIE["erbonsoftwarebotao"]) && $_COOKIE["erbonsoftwarebotao"] !== "" ) {
  setcookie("erbonsoftwarerefresh", 0);
  $nome1 = $_COOKIE["erbonsoftwarebotao"];
			
  for($j = 0; $j < $i; $j ++) {
if($nome[$j] == $nome1) {
  $idcampo = $id1[$j];
  setcookie("erbonsoftwareidcampo", $idcampo);
					
  $sql2 = "SELECT S.id AS Id, S.idServiceAccounts AS IdServiceAccount, 
		   SR.idServiceDepartments AS IdDepartment, 
		   S.[description] AS [Description], (CASE WHEN SR.priceSale = 0 OR SR.priceSale is null 
		   THEN S.priceSale ELSE SR.priceSale END) 
	           AS Price, S.icms AS Tax6, S.iss AS Tax1, S.ir AS Tax2, S.csll AS Tax3, 
		   S.pis AS Tax4, S.cofins AS Tax5, S.isProductKitchen AS IsProductKitchen, 
		   S.isServiceTax AS IsServiceTax, PrinterConfig.printerKitchen1 AS PrinterKitchen1, 
		   PrinterConfig.printerKitchen1FonteTicket AS PrinterKitchen1Font, 
		   PrinterConfig.printerKitchen2 AS PrinterKitchen2, 
		   PrinterConfig.printerKitchen2FonteTicket AS PrinterKitchen2Font, 
		   PrinterConfig.printerKitchen3 AS PrinterKitchen3, 
		   PrinterConfig.printerKitchen3FonteTicket AS PrinterKitchen3Font 
		   FROM Services S INNER JOIN ServicesDepartmentsRelationship SR ON S.id = SR.idServices 
		   AND SR.isActive = 1 AND SR.idServiceDepartments = (SELECT P.idDepartment 
		   FROM PointOfSale P WHERE P.id = ".$id.") 
		   LEFT JOIN ServicesPointOfSalePrinterKitchen Printer ON S.id=Printer.idProduct 
		   AND Printer.isActive = 1 AND Printer.idPointOfSale = ".$id." 
		   LEFT JOIN ServicesPrinterKitchen PrinterConfig 
		   ON Printer.idServicesPrinterKitchen = PrinterConfig.id  WHERE S.isActive = 1 
		   AND S.isProduct = 1 AND S.idPointOfSaleCategoryProduct = ".$idcampo." 
		   ORDER BY S.description ASC";
						
		   $result2 = sqlsrv_query($conn, $sql2);
		   $repeticoes = 0;
						
   while($row2 = sqlsrv_fetch_array($result2, SQLSRV_FETCH_NUMERIC)) {
$repeticoes = $repeticoes + 1;
$resultado3 = $row2[3];
$resultado4 = $row2[4];
?>
<form action="" method="post">
<input type="submit" class="bt6" value="<?php echo $resultado3;echo " R$ ";echo $resultado4;?>"name="botoes2">							
</form>
<?php
					}
				}
			}
		}
	}
?>
</div>
<div class="totaldebotoes">
	<div class="button4">
<?php
if(isset($_COOKIE["erbonsoftwarecontagem"]) && $_COOKIE["erbonsoftwarecontagem"] !== "") { 
   $for = $_COOKIE["erbonsoftwarecontagem"];
			
if(isset($_COOKIE["erbonsoftwarenome1"]) && $_COOKIE["erbonsoftwarenome1"] !== "") {
   for($p = 0; $p < $for; $p ++) {
?>
	<div class="caixa">
    <div class="nome">
<?php
		$p1 = $p + 1;
		$resposta1 = "0";
		$resposta2 = "0";
		$resposta3 = "0";
		$resposta4 = "0";
		$p5 = "0";
							
		for($p2 = 0; $resposta1 == "0"; $p2 ++) {
		if($_COOKIE["erbonsoftwarenome$p1"][$p2] == "R" && $_COOKIE["erbonsoftwarenome$p1"][$p2 + 1] == "$") {
		   $resposta1 = "1";							
		}
								
		else {
		   echo $_COOKIE["erbonsoftwarenome$p1"][$p2];
		}
	}
?>
</div>
<div class="quantidade">
<?php
	for($p4 = 0; $p4 <= $p; $p4 ++) {
	if($nome[$p] == $nome[$p4]) {
	if(isset($quantidade[$p4]) && $quantidade[$p4] !== "") {
			 $quantidade[$p4] = $quantidade[$p4] + 1;
	}
									
	else {
		$quantidade[$p4] = "1";
	}
}
								
else {
}
   }
							
   echo $quantidade[$p];
?>
</div>
<div class="preco">
<?php
   for($p3 = 0; $resposta2 == "0"; $p3 ++) {
	if($resposta3 == 0) {
	   if($_COOKIE["erbonsoftwarenome$p1"][$p3] == "R" && $_COOKIE["erbonsoftwarenome$p1"][$p3 + 1] == "$") {
		$resposta3 = "1";							
	}
									
	else {
	}
}

if($resposta3 == 1) {
   if($resposta4 == 3)	{
     $resposta2 = "1";
	}
									
	else {
	   echo $_COOKIE["erbonsoftwarenome$p1"][$p3];
										
	   if($resposta4 == 1 || $resposta4 == 2) {
		$resposta4 = $resposta4 + 1;
	}
}
									
									 
if(isset($_COOKIE["erbonsoftwarenome$p1"][$p3]) && $_COOKIE["erbonsoftwarenome$p1"][$p3] !== "" ) {	
										 
 if($_COOKIE["erbonsoftwarenome$p1"][$p3] == "." ) {	
	$resposta4 = $resposta4 + 1;
}
   }
  }
 }
?>
</div>					
<div class="remover">
   <form action="" method="post">
	<button type="submit" class="bt7"name="<?php echo $_COOKIE["erbonsoftwarenome$p1"]?>">Remover</button>						
   </form>
	</div>
	</div>
<?php
	}
}
   }
?>
	</div>
	<div class="button5">
		<input type="submit" class="bt8" value="Observações da camada" name="apagar">
	</div>
	<div class="precototal">
		<h3 class="textototal">Total</h3>
<?php
		if(isset($_COOKIE["erbonsoftwaretotalpedido"]) && $_COOKIE["erbonsoftwaretotalpedido"] !== "") { 
			$total = $_COOKIE["erbonsoftwaretotalpedido"];
		}
		
		else {
			$total = "0";
		}
		
		if(isset($_COOKIE["erbonsoftwaren1"]) && $_COOKIE["erbonsoftwaren1"] !== "") { 
			$n1 = $_COOKIE["erbonsoftwaren1"];
		}
		
		else {
			$n1 = "0";
		}
		
		if(isset($_COOKIE["erbonsoftwarecontagem"]) && $_COOKIE["erbonsoftwarecontagem"] !== "") { 
		$for = $_COOKIE["erbonsoftwarecontagem"];
				
		if(isset($_COOKIE["erbonsoftwarenome1"]) && $_COOKIE["erbonsoftwarenome1"] !== "") {
		for($p = 0; $p < $for; $p ++) {
			$p1 = $p + 1;
						
			$sql3 = "SELECT S.id AS Id, S.idServiceAccounts AS IdServiceAccount, SR.idServiceDepartments AS IdDepartment, 
			S.[description] AS [Description], (CASE WHEN SR.priceSale = 0 OR SR.priceSale is null THEN S.priceSale ELSE SR.priceSale END) AS Price, S.icms AS Tax6, S.iss AS Tax1, S.ir AS Tax2, S.csll AS Tax3, S.pis AS Tax4, S.cofins AS Tax5, S.isProductKitchen AS IsProductKitchen, S.isServiceTax AS IsServiceTax, PrinterConfig.printerKitchen1 AS PrinterKitchen1, PrinterConfig.printerKitchen1FonteTicket AS PrinterKitchen1Font, PrinterConfig.printerKitchen2 AS PrinterKitchen2, PrinterConfig.printerKitchen2FonteTicket AS PrinterKitchen2Font, PrinterConfig.printerKitchen3 AS PrinterKitchen3, PrinterConfig.printerKitchen3FonteTicket AS PrinterKitchen3Font FROM Services S INNER JOIN ServicesDepartmentsRelationship SR ON S.id = SR.idServices AND SR.isActive = 1 AND SR.idServiceDepartments = (SELECT P.idDepartment FROM PointOfSale P WHERE P.id = ".$id.")  LEFT JOIN ServicesPointOfSalePrinterKitchen Printer ON S.id=Printer.idProduct  AND Printer.isActive = 1 AND Printer.idPointOfSale = ".$id." LEFT JOIN ServicesPrinterKitchen PrinterConfig ON Printer.idServicesPrinterKitchen = PrinterConfig.id WHERE S.isActive = 1 and S.isProduct = 1 AND S.idPointOfSaleCategoryProduct = ".$_COOKIE["erbonsoftwareidcampo"]." ORDER BY S.description ASC";
$result3 = sqlsrv_query($conn, $sql3);
						
while($row3 = sqlsrv_fetch_array($result3, SQLSRV_FETCH_NUMERIC)) {
	$resultado5 = $row3[3];
	$resultado6 = $row3[4];
							
	if($p == $n1) {
	if($_COOKIE["erbonsoftwarenome$p1"] == $somar) {
		$total = $total + $resultado6;
		$n1 = $n1 + 1;
										
	}
								
	else {
  }
							}
							}
						}
					}
				}
		}
?>
		<div class="soma">
			<h3 class="textototal"><?php echo $total?>&nbsp;</h3>
			<h1>$</h1>
		</div>
	</div>
</div>

Good afternoon, I have the code below and I need to make the quantity increase, that is, I have a list of products and clicking the quantity "1" does not change to "2".

    
asked by anonymous 22.03.2018 / 19:02

0 answers