Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/03/2016, 03:47
Avatar de GUAPISNEY
GUAPISNEY
 
Fecha de Ingreso: marzo-2016
Mensajes: 14
Antigüedad: 8 años, 2 meses
Puntos: 0
Pasar varios valores

Hola a todos, haber si me podeis ayudar:

Código PHP:
Ver original
  1. <form id="buscador" name="buscador" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
  2.       <table width="419" border="3" align="center">
  3.   <tr>
  4.     <th height="41" colspan="2" bgcolor="#7E7EEF" scope="col"><div align="center" class="Estilo3">BUSCAR POR SEDE </div></th>
  5.     </tr>
  6.   <tr>
  7.     <td height="29" bgcolor="#C7C7F8"><div align="center">
  8.      
  9.       <p>
  10.         <select name="lista"  >
  11.           <option style="background:blue; color:white" value="fibra" selected="selected">FIBRA</option>
  12.           <option style="background:red; color:white" value="shdsl">SHDSL</option>
  13.           <option style="background:blue; color:white" value="radio">RADIO</option>
  14.    
  15.         </select>
  16.       </p>
  17.      
  18.     </div>      </td>
  19.     <td width="113" bgcolor="#C7C7F8"><div align="center">
  20.       <input type="submit" name="buscador" class="boton peque aceptar" value="buscar" />
  21.     </div></td>
  22.   </tr>
  23. </table>
  24.    
  25. </form>
  26.  
  27.  
  28.  <div align="center">
  29.  
  30.    
  31.       <?php
  32.     include("conexion.php");
  33.     $listar = trim($_POST['lista']);
  34.    
  35.    
  36.     $query=("select * from $listar ORDER BY codigo")or die(mysql_error());
  37.     $resultado= mysql_query($query);
  38.     ?>
  39.     <br />
  40.    
  41.     <table width="772" height="42" border="3" bgcolor="#C7C7F8">
  42.         <tr>
  43.           <th width="92" height="32" bgcolor="#000033" scope="col"><span class="Estilo9">CÓDIGO</span></th>
  44.           <th width="111" bgcolor="#000033" scope="col"><span class="Estilo9">PROVINCIA</span></th>
  45.           <th width="136" bgcolor="#000033" scope="col"><span class="Estilo9">Adm (RCL)</span></th>
  46.           <th width="131" bgcolor="#000033" scope="col"><span class="Estilo9">INTERFACE</span></th>
  47.           <th width="151" bgcolor="#000033" scope="col"><span class="Estilo9">VRF</span></th>
  48.           <th width="107" bgcolor="#000033" scope="col">EVENTO</th>
  49.         </tr>
  50.       </table>
  51.      
  52.       <?php
  53.    
  54.    
  55.     $num_fila = 0;
  56.     while($row=mysql_fetch_assoc($resultado))
  57.     {
  58.    
  59.      
  60.    
  61.             if ($num_fila%2==0) {
  62.         ?>
  63.        
  64.          <table width="772" height="42" border="3" bgcolor="#C7C7F8">
  65.         <tr>
  66.           <th width="92" height="32" scope="col"><span class="Estilo5"><?php echo $row['codigo']; ?></span></th>
  67.           <th width="112" scope="col"><span class="Estilo5"><?php echo $row['provincia']; ?></span></th>
  68.           <th width="135" scope="col"><span class="Estilo5"><?php echo $row['administrativor']; ?></span></th>
  69.           <th width="131" scope="col"><span class="Estilo5"><?php echo $row['interface']; ?></span></th>
  70.           <th width="151" scope="col"><span class="Estilo5"><?php echo $row['vrf']; ?></span></th>
  71.           <th width="107" bgcolor="#000033" scope="col"><a href="mostrar2.php?id=<?php echo $row['id'] & $listar ?>">MOSTRAR</th>
  72.         </tr>
  73.       </table>
  74.      
  75.       <?php

RESUMO:
1.- <select name="lista" > Aqui elijo en que tabla quiero que busque e imprimo algunos campos de esa tabla.
2.- <a href="mostrar2.php?id=<?php echo $row['id'] & $listar ?>">MOSTRAR</th>

y aqui cuando clico quiero que me muestre el ese id y sus campos en otra pagina...pero solo puedo capturar el id con:
$v1 = $_GET['id'];
pero no se en que tabla buscar porque no se como pasar $listar

Alguna idea?