help with array in php

0

I have this

 <?php
 session_start();

 if(isset($_GET['p'])){
  $_SESSION['producto'][$_SESSION['contador']] = $_GET['p']; 
 $_SESSION['contador']++;
 }

if (isset($_GET['c'])){
$_SESSION['cantidad'][$_SESSION['contador']] = $_GET['c'];

}

for ($i=0; $i < $_SESSION['contador']; $i++){       
    $query = mysqli_query($conect,'SELECT * FROM Productos WHERE 
   id='.$_SESSION['producto'][$i].'');

    while ($fila = mysqli_fetch_array($query)) {

        $cab = $_SESSION['cantidad'][$i+1];

        $total = $fila['Precio']*$cab;

            echo '<tr>';
            echo '<td>'.$fila['Nombre'].'</td>';
            echo '<center><td>';
            echo '<center><input type=number name=ja class="la" 
          value='.$cab.'></center>';
            echo '</td></center>';

            echo '<td>'.number_format($total,2).'</td>';
            echo '<td>';

The problem is that when I enter the numeric input I pass some data with the value and other gaps in particular the 1 2 come with the value and the 3 comes out without any value and so the 7 same nose that happens

    
asked by jose moya 21.10.2017 в 22:32
source

0 answers