Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/11/2015, 11:07
razorkale
 
Fecha de Ingreso: noviembre-2015
Mensajes: 2
Antigüedad: 8 años, 5 meses
Puntos: 0
Añadir datos segun combobox

Hola a todos, gracias de antemano.

Ahora mismo tengo una duda referente a los Select de los combobox, actualmente tengo el menú desplegable que meustra el numero de identificacion de los usuarios registrados, lo que requiero es que, pulsando en el menú el numero de identificacion, añada datos nuevos a dicho perfil tras pulsar su numero de identificacion en el menu. SIn embargo no funciona, no toma el perfil tras pulsarlo y por lo tanto no añade datos.

Aqui el codigo del menu y los dos campos de texto para agregar los datos sobrantes

Código PHP:
<CENTER>
<?php


include 'conexion.php';


    
$query="SELECT (cedula) FROM datos";
    
    
$resultado=$mysqli->query($query);
?>

<select>    
    <?php    
    
while ( $row $resultado->fetch_array() )    
    {
        
?>
    
        <option value=" <?php echo $row['cedula'?> " >
        <?php echo $row['cedula']; ?>
        </option>
        
        <?php
    
}    
    
?>        
</select>
<?php

?>
</CENTER>
<html>
    <body>

        
        <center><h1>Telefono y Direccion</h1></center>
        
        <form name="telefonos" method="POST" action="guarda_telefono.php">
            <table width="50%">
                <tr>
                    <td width="20"><label for="name">Telefono</label>
                    <td width="30"><input  type="text" name="telefono" size="25"  /></td>
                </tr>
                <tr>
                    <td><b>Direccion</b></td>
                    <td><input type="text" name="direccion" size="25"   /></td>
                </tr>

                <tr>

                    <td colspan="2"><center><input type="submit" name="enviar" value="Registrar" /></center></td>
                </tr>
            </table>
        </form>
    </body>
</html>
y aqui el insert

Código PHP:
<?php 
    
    
require('conexion.php');
    
    
$telefono=$_POST['telefono'];
    
$direccion=$_POST['direccion'];


    echo 
$query="INSERT INTO datos2 (telefono, direccion) VALUES ('$telefono','$direccion')";
    
    
$resultado=$mysqli->query($query);


    
    
?>
<html>
    <head>
        <title>Guardar usuario</title>
    </head>
    <body>
        <center>    
            

            
            <p></p>    
            
            <a href="Telefono.php">Regresar</a>
            
        </center>
    </body>
    </html>