Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action = "consultadirecta.php" method="POST" >
- Seccion: <input type="tex" name="txtclave" ></br>
- <select name="txtregion">
- <option value="0">Seleccione:</option>
- <?php
- $consulta = mysqli_query($conexion, "SELECT * FROM tabla1 GROUP BY region HAVING COUNT(*)>1" ) ;
- while ($valores = mysqli_fetch_array($consulta)) {
- echo '<option value="'.$valores['ID'].'">'.$valores['Region'].'</option>';
- }
- ?>
- </select>
- </br>
- <input type="submit" value="buscar" name="btnbuscar">
- </form>
- <?php
- include ("conexion.php");
- $clave = isset($_POST['txtclave']) ? $_POST['txtclave'] : null;
- $region = isset($_POST['txtregion']) ? $_POST['txtregion'] : null;
- $consulta = mysqli_query($conexion, "SELECT * from tabla1 WHERE Clave='$clave' or Region='$region' " )
- or die ("Error al traer datos");
- echo '<table border="1">';
- echo '<th id = "id">ID</th>';
- echo '<th id = "clave">clave</th>';
- echo '<th id = "region">region</th>';
- echo '<th id = "encuestador">encuestador</th>';
- echo '<th id = "encuestado">encuestado</th>';
- echo '</tr>';
- while ($extraido = mysqli_fetch_array($consulta))
- {
- echo '<tr>';
- echo '<td>'.$extraido['ID'].'</td>';
- echo '<td>'.$extraido['clave'].'</td>';
- echo '<td>'.$extraido['region'].'</td>';
- echo '<td>'.$extraido['encuestador'].'</td>';
- echo '<td>'.$extraido['encuestado'].'</td>';
- >";
- echo '</tr>';
- }
- mysqli_close($conexion);
- echo '</table>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement