Ver Mensaje Individual
  #20 (permalink)  
Antiguo 09/06/2009, 13:43
Avatar de gjx2
gjx2
 
Fecha de Ingreso: agosto-2008
Ubicación: R.D
Mensajes: 1.153
Antigüedad: 15 años, 8 meses
Puntos: 139
Respuesta: ayuda urgente

Código PHP:

<?PHP
 
                     
if(isset($_POST["envio"])){
        
        
                    for (
$a 0$a $_POST["chk"]; $a++ ){
              
                    
$capacidad $_POST["capacidad"][$a];
                    
$precio_usb $_POST['precio_usb_'.$a];
                    
                    
                    if((!empty(
$precio_usb)) && (isset($precio_usb))){
             
                    
$sql_capacidad_precio  "insert into miusb_capacidad_precio(capacidad,precio_usb)";
                    
$sql_capacidad_precio .= "values('$capacidad','$precio_usb')";
                    
                    echo 
$sql_capacidad_precio;
                    echo 
"<br/>";
                    
mysql_query($sql_capacidad_precio) or die(mysql_error());
                                    
            }  
        }
        
        
        }

?>



Código HTML:
Ver original
  1. <?PHP
  2.  
  3.             $sql_capacidad = "SELECT * FROM miusb_capacidades";
  4.            $rpta_capacidad = mysql_query($sql_capacidad) or die(mysql_error());
  5.             $i = 0;
  6. ?>
  7.         <form name="Form" action="<?=$_SERVER['PHP_SELF']?>" method="post">
  8.             <table width="197" border="0" cellspacing="0" cellpadding="0">    
  9.                 <tbody>
  10.          <?php while($capacidad = mysql_fetch_array($rpta_capacidad)):?>
  11.                
  12.          
  13.             <tr>
  14.               <td width="31"><input name="capacidad[<?=$i?>]" type="checkbox" class="objetoformulario" id="capacidad" value="<?=$capacidad['Capacidad'];?>" /></td>
  15.               <td width="62"><?=$capacidad['Capacidad'];?></td>
  16.               <td width="104"><input name="precio_usb_<?=$i;?>" type="text" class="objetoformulario" size="12" /></td>
  17.             </tr>
  18.          
  19.            
  20.          <?php
  21.           $i++;
  22.          endwhile;    
  23.         ?>
  24.             </tbody>
  25.          </table>
  26.          <input type="hidden" name="chk" value="<?=$i?>">
  27.          <input type="submit" name="envio" value="Comprobar">
  28.          </form>


Con esto te debe de funcionar .