Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/03/2012, 15:48
Avatar de ylellan
ylellan
 
Fecha de Ingreso: mayo-2010
Ubicación: en un lugar de Veracruz
Mensajes: 432
Antigüedad: 14 años
Puntos: 36
Respuesta: formulario para buscar en base de datos un registro

corazon, haciendo algo mas basico :

Código HTML:
Ver original
  1. <form action="otra.php" method="post">
  2. No de cedula: <input type="text" name="cedula">
  3. <br>
  4. <input type="submit" name="enviar" value="enviar">
  5. </form>

y la pagina de otra.php

Código PHP:
<?php
if(isset($_POST['enviar'])){
    if(!empty(
$_POST['cedula'])){
    
$cedula=$_POST['cedula'];
    
$conexion mysql_connect("localhost""root""16313024");
    
mysql_select_db("registro"$conexion);

    
$q "SELECT * FROM alumnos WHERE ID='$cedula'";
    
$resEmp mysql_query($q$conexion) or die(mysql_error());
    
$totEmp mysql_num_rows($resEmp);
    if (
$totEmp>0)
    {    
    while (
$rowEmp mysql_fetch_assoc($resEmp)) {
    echo 
"Nombre: <strong>".$rowEmp['nombre']."</strong><br></br>";
    echo 
"Apellidos:<strong>".$rowEmp['apellido']."</strong><br></br>";
    echo 
"Nota Primer Lapso: ".$rowEmp['nota1']."<br></br>";
    echo 
"Nota Segundo Lapso: ".$rowEmp['nota2']."<br></br>";
    echo 
"Nota Tercer Lapso: ".$rowEmp['nota3']."<br></br>";
    echo 
"Nota Definitiva: ".$rowEmp['nota_final']."<br></br>";
    }
else
{
header("location:index.php");
}


}
else
{
header("location:index.php");
}

}
?>
y haber que sale corazon