31/03/2012, 17:16
|
| | Fecha de Ingreso: marzo-2012
Mensajes: 17
Antigüedad: 12 años, 1 mes Puntos: 0 | |
Respuesta: formulario para buscar en base de datos un registro Cita:
Iniciado por ylellan corazon, haciendo algo mas basico :
Código HTML:
Ver original<form action="otra.php" method="post"> No de cedula: <input type="text" name="cedula"><input type="submit" name="enviar" value="enviar">
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 el codigo otra.php tiene un error en la linea 21 |