Ver Mensaje Individual
  #7 (permalink)  
Antiguo 30/04/2013, 10:33
lramirez
 
Fecha de Ingreso: febrero-2013
Mensajes: 66
Antigüedad: 11 años, 3 meses
Puntos: 1
Respuesta: problema de bariables

creo ya nos hicimos bolas mira realizo una consulta esta me muestra las existencias y producto
Código PHP:
Ver original
  1. $SQL="Select*From existencias WHERE producto='".$_POST['producto']."'";
  2.  
  3.  
  4.  if($resultado = mysql_query($SQL,$con))
  5. {
  6. while($fila = mysql_fetch_array($resultado))
  7. {
  8.  echo"<table width='200' border='1' align='center'>";
  9.   echo" <tr>";
  10.  echo" <tr width='51'>&nbsp;</tr> ";
  11.    echo" </tr>";
  12.    
  13.   echo" <tr>";
  14.     echo" <td width='54'>cantiad</td>";
  15.     echo" <td width='67'>consumible</td>";
  16.   echo" </tr>";
  17.   echo" <tr>";
  18.    echo"  <td><textarea rows=1 cols=20      name=cantidad >".$fila['cantidad']."</textarea></td>";
  19.      echo"<td><textarea rows=1 cols=20      name=consumible >".$fila['producto']."</textarea></td>";
  20.   echo" </tr>";
  21.  echo"</table>";
  22. }
  23. }      
  24. else{echo '<p>'.mysql_error().'</p>';}

lo que trato de realizar a continuación es colocar una caga de texto en donde pueda yo colocar un numero y realizar la suma
Código PHP:
Ver original
  1. echo"<table width='200' border='1' align='left'>";
  2.   echo" <tr>";
  3.     echo" <td width='54'>cantiad</td>";
  4.   echo" </tr>";
  5.   echo" <tr>";
  6. echo"<td><textarea rows=1 cols=20 name=cantidad2></textarea></td>";
  7.   echo" </tr>";
  8.  echo"</table>";
después hago la suma
Código PHP:
Ver original
  1. $cantidad2 = cant;
  2.  
  3. $num= $_POST['cantidad'];
  4. $num1=$_POST['cant'];
  5. $numero_uno = $num;
  6. $numero_dos =$num1;
  7.  $suma_total = $numero_uno+$numero_dos;
  8.  
  9.  echo "la cantidad de consumibles es   $suma_total";

asta aquí me da error de de variables y definidas no ce si debo de cambiar la estructura o las sentencias