Foros del Web » Programando para Internet » PHP »

No recibo un input type="radio"

Estas en el tema de No recibo un input type="radio" en el foro de PHP en Foros del Web. No recibe POST Tengo un código simple pero no me recibe el POST del type="radio, de todo los demás si :S Os pongo el código ...
  #1 (permalink)  
Antiguo 16/09/2011, 11:15
Avatar de Jota_sk  
Fecha de Ingreso: octubre-2008
Mensajes: 188
Antigüedad: 15 años, 6 meses
Puntos: 0
No recibo un input type="radio"

No recibe POST

Tengo un código simple pero no me recibe el POST del type="radio, de todo los demás si :S

Os pongo el código

Código PHP:
<?php

if (isset($_POST['titulo'])){
    
$sql 'INSERT INTO validar (titulo,sinopsis,caratula,link1,link2,idcategoria) VALUES ("'.$_POST["titulo"].'", "'.$_POST["sinopsis"].'", "'.$_POST["caratula"].'", "'.$_POST["link1"].'", "'.$_POST["link2"].'", "'.$_POST["cat"].'")';
    echo 
$sql;
}

?>
<form action="add.php" method="POST">
    <label>Titulo</label>
    <input type="text" name="titulo">
    <br>
    <label>Caratula</label>
    <input type="text" name="caratula">
    <br>
    <label>Sinopsis</label>
    <input type="text" name="sinopsis">
    <br>
    <label>Link1</label>
    <input type="text" name="link1">
    <br>
    <label>Link2</label>
    <input type="text" name="link2">
    <br>
    <label>Categoria</label>
        <?php
        $sql 
'SELECT * FROM categorias;';
        
$res=mysql_query($sql,$conn);
        while(
$row=mysql_fetch_array($res)){
            echo 
'<input type="radio" name="cat" value="'.$row['id'].'">'.$row['categoria'].'';
        }    
        
?>    
    <br>
    <br>
    <input type="submit">
</form>
  #2 (permalink)  
Antiguo 16/09/2011, 11:25
Avatar de gogupe  
Fecha de Ingreso: octubre-2006
Ubicación: Mallorca
Mensajes: 897
Antigüedad: 17 años, 6 meses
Puntos: 32
Respuesta: No recibo un input type="radio"

Asegurate que value recibe un valor correcto... mira el código fuente en el navegador y fíjate que sale bien.

En teoría no veo ningún fallo.
  #3 (permalink)  
Antiguo 16/09/2011, 11:27
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: No recibo un input type="radio"

Al recibir el formulario intenta depurar todo lo que viene con el POST:
Código PHP:
var_dump($_POST); 
¿Se muestra el campo que mencionas?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #4 (permalink)  
Antiguo 16/09/2011, 11:27
Avatar de Jota_sk  
Fecha de Ingreso: octubre-2008
Mensajes: 188
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: No recibo un input type="radio"

Pues tenias razón! no recibia ningun valor, era eso xD Gracias, llevaba un buen rato mirando el codigo y nada y resulta que la tabla no se llama 'id' xD

Etiquetas: input, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:48.