lostpr Posted June 26, 2013 Share Posted June 26, 2013 Hi,The code I show below works correctly. But I need to develop the page numbers and next / previous buttons.some helpthanks<html><head><title>Búsqueda de doctores</title><style type="text/css">table {background-color: #fcf;}th {width: 150px;text-align: left;}</style></head><body><h1>Búsqueda de doctores</h1><form method="post" action="busquedadoctores.php"><input type="hidden" name="submitted" value="true" /><label>Busqueda por especialidad:<select name="especialidad"><?phpif(trim($_POST['especialidad']) != ""){echo '<option value="'.stripslashes($_POST['especialidad']).'">'.stripslashes($_POST['especialidad']).'</option>';}?><option value=" ">Please select</option><option value="Alergista e Inmunología">Alergista e Inmunología</option><option value="Anestesiólogo">Anestesiólogo</option><option value="Cardiólogo">Cardiólogo</option><option value="Cirujano">Cirujano</option><option value="Cirujano cardiovascular">Cirujano cardiovascular</option><option value="Cirujano maxilofacial">Cirujano maxilofacial</option><option value="Cirujano plástico">Cirujano plástico</option><option value="Dentista">Dentista</option<option value="Dermatólogo">Dermatólogo</option //verify why this option has this color<option value="Emergenciólogo">Emergenciólogo</option><option value="Endocrinólogo">Endocrinólogo</option><option value="Fisiatra">Fisiatra</option><option value="Gastroenterólogo">Gastroenterólogo</option><option value="Generalista">Generalista</option><option value="Ginecólogo">Ginecólogo</option><option value="Hematólogo">Hematólogo</option<option value="Infectólogo">Infectólogo</option><option value="Internista">Internista</option><option value="Nefrólogo">Nefrólogo</option><option value="Neumólogo">Neumólogo</option><option value="Neurólogo">Neurólogo</option<option value="Oftalmólogo">Oftalmólogo</option><option value="Oncólogo">Oncólogo</option><option value="Optómetra">Optómetra</option><option value="Ortopeda">Ortopeda</option><option value="Pediatra">Pediatra</option><option value="Podiatra">Podiatra</option><option value="Proctólogo">Proctólogo</option><option value="Psiquiatra">Psiquiatra</option<option value="Quiropráctico">Quiropráctico</option><option value="Reumatólogo">Reumatólogo</option><option value="Urólogo">Urólogo</option></select></label>Busqueda por pueblo:<select name="pueblo"><?phpif(trim($_POST['pueblo']) != ""){echo '<option value="'.stripslashes($_POST['pueblo']).'">'.stripslashes($_POST['pueblo']).'</option>';}?><option value=" ">Please select</option><option value="Adjuntas">Adjuntas</option><option value="Aguada">Aguada</option><option value="Aguadilla">Aguadilla</option><option value="Aguas Buenas">Aguas Buenas</option><option value="Aibonito">Aibonito</option><option value="Añasco">Añasco</option><option value="Arecibo">Arecibo</option><option value="Arroyo">Arroyo</option><option value="Barceloneta">Barceloneta</option><option value="Barranquitas">Barranquitas</option><option value="Bayamón">Bayamón</option><option value="Cabo Rojo">Cabo Rojo</option><option value="Caguas">Caguas</option><option value="Camuy">Camuy</option><option value="Canóvanas">Canóvanas</option><option value="Carolina">Carolina</option><option value="Cataño">Cataño</option><option value="Cayey">Cayey</option><option value="Ceiba">Ceiba</option><option value="Ciales">Ciales</option><option value="Cidra">Cidra</option><option value="Coamo">Coamo</option><option value="Comerío">Comerío</option><option value="Corozal">Corozal</option><option value="Culebra">Culebra</option><option value="Dorado">Dorado</option><option value="Fajardo">Fajardo</option><option value="Florida">Florida</option><option value="Guánica">Guánica</option><option value="Guayama">Guayama</option><option value="Guayanilla">Guayanilla</option><option value="Guaynabo">Guaynabo</option><option value="Gurabo">Gurabo</option><option value="Hatillo">Hatillo</option><option value="Hormigueros">Hormigueros</option><option value="Isabela">Isabela</option><option value="Jayuya">Jayuya</option><option value="Juana Díaz">Juana Díaz</option><option value="Juncos">Juncos</option><option value="Lajas">Lajas</option><option value="Lares">Lares</option><option value="Las Marías">Las Marías</option><option value="Las Piedras">Las Piedras</option><option value="Loíza">Loíza</option><option value="Luquillo">Luquillo</option><option value="Manatí">Manatí</option><option value="Maricao">Maricao</option><option value="Maunabo">Maunabo</option><option value="Mayaguez">Mayaguez</option><option value="Moca">Moca</option><option value="Morovis">Morovois</option><option value="Naguabo">Naguabo</option><option value="Naranjito">Naranjito</option><option value="Orocovis">Orocovis</option><option value="Patillas">Patillas</option><option value="Peñuelas">Peñuelas</option><option value="Ponce">Ponce</option><option value="Quebradillas">Quebradillas</option><option value="Rincón">Rincón</option><option value="Rio Grande">Rio Grande</option><option value="Sabana Grande">Sabana Grande</option><option value="Salinas">Salinas</option><option value="San Germán">San Germán</option><option value="San Juan">San Juan</option><option value="San Lorenzo">San Lorenzo</option><option value="Santa Isabel">Santa Isabel</option><option value="Toa Alta">Toa Alta</option><option value="Toa Baja">Toa Baja</option><option value="Trujillo Alto">Trujillo Alto</option><option value="Utuado">Utuado</option><option value="Vega Alta">Vega Alta</option><option value="Vega Baja">Vega Baja</option><option value="Vieques">Vieques</option><option value="Villalba">Villalba</option><option value="Yabucoa">Yabucoa</option><option value="Yauco">Yauco</option><input type="submit" /></form><?phpif (isset($_POST['submitted'])) {//connect databaseinclude('connect.php');$especialidad = trim(stripslashes($_POST['especialidad']));$pueblo = trim(stripslashes($_POST['pueblo']));if($especialidad != ""){$query = "SELECT * FROM doctores WHERE `ESPECIALIDAD` LIKE '%$especialidad%'";if($pueblo != ""){$query .= "and `pueblo` = '$pueblo'";}$result = mysql_query($query) or die(mysql_error());$num_rows = mysql_num_rows($result);echo "$num_rows result found";if($num_rows > 0){echo "<table>";echo "<tr> <th>Nombre</th> <th>Especialidad</th> <th>Dirección</th> <th>Pueblo</th> <th>País</th> <th>Código postal</th> <th>Teléfono</th> <th>Email</tr>";while ($row = mysql_fetch_array($result)) {echo "<tr><td>";echo $row['NOMBRE'];echo "</td><td>";echo $row['ESPECIALIDAD'];echo "</td><td>";echo $row['DIRECCION'];echo "</td><td>";echo $row['PUEBLO'];echo "</td><td>";echo $row['PAIS'];echo "</td><td>";echo $row['CODIGO_POSTAL'];echo "</td><td>";echo $row['TELEFONO'];echo "</td><td>";echo $row['EMAIL'];echo "</td></tr>";}echo "</table>";}}}?></body></html> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted June 26, 2013 Share Posted June 26, 2013 have you tried looking at the basic pagination tutorial for this site???? http://www.phpfreaks.com/tutorial/basic-pagination Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.