Ver Mensaje Individual
  #5 (permalink)  
Antiguo 28/02/2014, 14:46
Avatar de Briss
Briss
 
Fecha de Ingreso: junio-2011
Mensajes: 1.293
Antigüedad: 12 años, 10 meses
Puntos: 12
Respuesta: Si mi select es igual a 0 no insertar

hice esto

Código HTML:
<form action="registrarmultiple.php" method="post"  name="form1" id="form1" enctype="multipart/form-data">
  
   <td colspan="7" width="196" height="24" border="0"  alt=""/><select name="selec1" id="select1"  style="width:195px"  class="select" >
 <option value="0">Elige una opción</option>
<?php   

 
  ...
?>  
        </select>
        
        <input type="text" name="caja1" id="caja1" size="2" maxlength="25" value=""/>
          
          

   
  <select name="select2" id="select2"  style="width:188px"  class="select" >
 <option value="0">Elige una opción</option>
<?php   

..
?>  
        </select>
        
        <input type="text" name="caja2" id="caja2" size="2" maxlength="25" value=""/>
          
           
  
    <select name="select3" id="select3"  style="width:184px"  class="select" >
 <option value="0">Elige una opción</option>
<?php   

...
?>  
        </select>
        
        <input type="text" name="caja3" id="caja3" size="2" maxlength="25" value=""/>

     <input type="image" width="87" height="19" border="0"  alt="" />
  <input type="hidden" name="MM_insert" value="form1" /></form> 
y asi intento insertar pero no he logrado hacerlo no me manda ningun error pero al ir a mi tabla no hay nada

Código PHP:
<?php require_once('connection.php');

for(
$i=1;$i<=3;$i++){ 
    
$valor_select $_POST["select$i"]; 

   if(
$valor_select==0){ 
    break; 
    
   }else{        
    
//INSERTAR DATOS O LO QUE SEA  
//ACA TENGO DUDAS DEBO HACER ESTO PARA SELECT2 Y 3 ENTONCES??? (SOLO LA CONSULTA)
    
$s1=$_POST['select1'];
$c1=$_POST['caja'];

$s2=$_POST['select2'];
$c2=$_POST['caja2'];

$s3=$_POST['select3'];
$c3=$_POST['caja3'];
mysql_select_db($database_connection$connection);
$update=mysql_query("INSERT INTO probando (seleccion,texto)
VALUES
('$select1','$caja1')"
);




}  
header("location: Index.htm");
?>