Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/11/2010, 23:56
Alfredex
 
Fecha de Ingreso: mayo-2009
Mensajes: 34
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Necesito Ayuda

Cita:
Iniciado por ylellan Ver Mensaje
se me ocurren un monton de soluciones pero la mas sencilla corazon puede ser la sig:

Código HTML:
Ver original
  1. <?php echo $_GET['comentario'];?>
  2. <form action="nueva.php" method="post">
  3. Gaseosas<br>
  4. <input type="checkbox" name="gas1" value="1">
  5. <input type="checkbox" name="gas2" value="2">
  6. <input type="checkbox" name="gas3" value="3">
  7. <input type="checkbox" name="gas4" value="4">
  8. <input type="checkbox" name="gas5" value="5">
  9. <input type="submit" name="enviar" value="enviar">
  10. </body>
  11. </html>

nueva.php
Código PHP:
<?php
if(isset($_POST['enviar'])){
if(!empty(
$_POST['gas1']) || !empty($_POST['gas2']) || !empty($_POST['gas3']) || !empty($_POST['gas4']) || !empty($_POST['gas5'])){
$gaseosa=$_POST['gas1']."-".$_POST['gas2']."-".$_POST['gas3']."-".$_POST['gas4']."-".$_POST['gas5'];
mysql_query("INSERT INTO tabla(campo1,campo2)VALUE('$var','$gaseosa')") or die("error".mysql_error());
}
else{
header("location:index.php?comentario=falta_seleccionar_valor");
}
}
?>

Biennn! gracias.. pero dime... q pasaria si no elige una de las opciones... las q estan en blanco como se guardan en la bd?