Yo lo haría así!
Código HTML:
<html>
<body>
<form method="POST" action="buscar.php">
<strong>Cedula:</strong> <input type="text" name="ced" size="20"><br><br>
<input type="submit" value="Buscar" name="buscar">
</form>
</body>
</html>
en el archivo
buscar.php Código PHP:
<html>
<body>
<?php
if (!isset($buscar)){
echo "Debe especificar una cadena a bucar";
echo "</html></body> \n";
exit;
}
$link = mysql_connect("localhost", "nobody");
mysql_select_db("mydb", $link);
$result = mysql_query("SELECT * FROM personal WHERE cedula '%$buscar%' ORDER BY nombre", $link);
if ($row = mysql_fetch_array($result)){
echo "<table border = '1'> \n";
//Mostramos los nombres de las tablas
echo "<tr> \n";
while ($field = mysql_fetch_field($result)){
echo "<td>$field->name</td> \n";
}
echo "</tr> \n";
do {
echo "Cedula:" . $reg['cedula'] . "<br>";
echo "Apellidos:" . $reg['apellidos'] . "<br>";
echo "Nombres:" . $reg['nombre'] . "<br>";
echo "Puesto" . $reg['puesto'] . "<br>";
echo "Sueldo" . $reg['sueldo'] . "<br>"; </a></td> n";
echo "</tr> n";
} while ($row = mysql_fetch_array($result));
echo "</table> n";
} else {
echo "¡ No se ha encontrado ningún registro !";
}
?>
</body>
</html>