Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <form action = "consultadirecta.php" method="POST" >
  2. Seccion: <input type="tex" name="txtclave" ></br>
  3.  
  4. <select name="txtregion">
  5. <option value="0">Seleccione:</option>
  6. <?php
  7.  
  8. $consulta = mysqli_query($conexion, "SELECT * FROM tabla1 GROUP BY region HAVING COUNT(*)>1" ) ;
  9. while ($valores = mysqli_fetch_array($consulta)) {
  10. echo '<option value="'.$valores['ID'].'">'.$valores['Region'].'</option>';
  11. }
  12. ?>
  13. </select>
  14.  
  15. </br>
  16. <input type="submit" value="buscar" name="btnbuscar">
  17.  
  18. </form>
  19.  
  20. <?php
  21.  
  22. include ("conexion.php");
  23. $clave = isset($_POST['txtclave']) ? $_POST['txtclave'] : null;
  24. $region = isset($_POST['txtregion']) ? $_POST['txtregion'] : null;
  25.  
  26.  
  27. $consulta = mysqli_query($conexion, "SELECT * from tabla1 WHERE Clave='$clave' or Region='$region' " )
  28. or die ("Error al traer datos");
  29.  
  30. echo '<table border="1">';
  31. echo '<th id = "id">ID</th>';
  32. echo '<th id = "clave">clave</th>';
  33. echo '<th id = "region">region</th>';
  34. echo '<th id = "encuestador">encuestador</th>';
  35. echo '<th id = "encuestado">encuestado</th>';
  36. echo '</tr>';
  37.  
  38. while ($extraido = mysqli_fetch_array($consulta))
  39. {
  40. echo '<tr>';
  41. echo '<td>'.$extraido['ID'].'</td>';
  42. echo '<td>'.$extraido['clave'].'</td>';
  43. echo '<td>'.$extraido['region'].'</td>';
  44. echo '<td>'.$extraido['encuestador'].'</td>';
  45. echo '<td>'.$extraido['encuestado'].'</td>';
  46. >";
  47. echo '</tr>';
  48. }
  49. mysqli_close($conexion);
  50. echo '</table>';
  51.  
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement