0
<?php  
    $conexion =  mysqli_connect("localhost", "root","admin123","database");
    $sentencia = "SELECT * FROM cliente order by  cliente asc";
    $query = mysqli_query($conexion,$sentencia);
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Editar Cliente</title>
    <link rel="stylesheet" type="text/css" href="estilos.css">
</head>
<body>      
    <center>
        <table width="280" cellspacing="1" cellpadding="3" border="0" bgcolor="#1E679A">
        <h1>Editar Cliente</h1>

        <form action="editarCliente_submit" method="get" accept-charset="utf-8">

        </form>
        <br> <label>Nombre Del Cliente : </label>
        <select name="Clientes">

            <?php while ($arreglo = mysqli_fetch_array($query)) { ?>

            <option value="<?php echo $arreglo['nombre_Cliente']?>"><?php echo $arreglo ['NIT']?></option>

            <?php } ?>

            option
        </select></br>

        <br> <label>NIT : </label>
        <input type="text" name="user" placeholder="Ingrese el NIT del cliente" required size="30" maxlength="30" style="margin-left: 5%" /><br/>

        <br> <label style="margin-left: -10%"> ¿Se realizan RIPS?  </label>
        <input type="text" name="user" placeholder="" required size="10" maxlength="15"/><br/>

        <br><input type="submit" name="Modificar_Cliente" value ="Modificar" onclick="location='http://localhost/Aeroasistencia/Administracion/modificarCliente.php'" style="margin-right: 3%">

        <input type="submit" name="Nuevo_Cliente" value ="Nuevo" onclick="location='http://localhost/Aeroasistencia/Administracion/nuevoCliente.php'">

        <input type="submit" value="Volver" onclick="history.back(-1)" style="margin-left: 3%" />


        </table>
    </center>

</body>
</html>
3

2 respuestas 2

0

Esto lo pones debajo de tu Query

$cliente = array();

while ($arreglo = mysqli_fetch_array($query)) 
{      
    $cliente[] = array(
        "nombre_Cliente" => $data['nombre_Cliente'],
        "nit" => $data['NIT'],
    );
}

Abajo en el select

if (count($cliente) > 0) //este es tu array con resultrados
{
    foreach ($cliente as $ti) 
    {
        echo "<option value='". $ti['nombre_Cliente'] ."'>". $ti['nit'] ."</option>";
    }
}

Pero te sugiero que en el option value indiques el id de tu tabla.

En donde dice Nit indica el nombre y el nit separados por un guion

0

Cuando haces la consulta, la puedes traer en un json, luego en el formulario

if (count($aTipoIndicador) > 0)    //este es tu array con resultrados
{
    echo "<option value=''>".$aIdioma['seleccione']."</option>";
    foreach ($aTipoIndicador as $ti) 
    {
        echo "<option value='". $ti['idTipoIndicadorencode'] ."' data-id='". $ti['idTipoIndicadorencode'] ."'>". $ti['nombreTipoIndicador'] ."</option>";
    }
} 
else
{
    echo "<option value=''>".$aIdioma['noHayTipoIndicador']."</option>";                                                
}
3

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.