Ver Mensaje Individual
  #8 (permalink)  
Antiguo 17/12/2009, 21:14
3ggtosh
 
Fecha de Ingreso: diciembre-2009
Mensajes: 6
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: Lista/Menu mysql y php

mira yo e estado intentando hacer un array pero solo me escoje el primero echale un vistaso

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Documento sin título</title>
  6. </head>
  7.  
  8. <body>
  9. <?
  10. mysql_connect("localhost","root","root");
  11. mysql_select_db("usuarios");
  12.  
  13. $sql_query=mysql_query("SELECT * FROM registrados");
  14. $este= mysql_fetch_assoc($sql_query);
  15.  
  16. ?>
  17.  
  18. <?
  19. $lista_l=$_POST['lista'];
  20. $array= array($este['pass']=>$este['user']);
  21.  
  22. ?>
  23.  
  24. <div id="log_box">
  25.   <form ACTION="" id="form1" name="form1" method="POST">
  26.     <table width="400">
  27.     <tr>
  28.       <td>qUsuario</td>
  29.       <td><select name="lista" id="lista">
  30.       <option value="100">tito</option>
  31.      <? while($res=mysql_fetch_array($sql_query)){
  32.          echo '<option value="'.$res['pass'].'">'.$res['user'].'</option>';
  33.      }
  34.          ?>
  35. </select></td>
  36.     </tr>
  37.     <tr>
  38.       <td>tu password es</td>
  39.       <td><? echo ''.$lista_l;  ?></td>
  40.     </tr>
  41.     <tr>
  42.       <td colspan="2"><label>
  43.         <input type="submit" name="button" id="button" value="Enviar" />
  44.       </label></td>
  45.       </tr>
  46.     <tr>
  47.       <td colspan="2">
  48.       <? echo 'es '.$array["$lista_l"]; ?>
  49.       </td>
  50.     </tr>
  51.   </table>
  52.   </form>
  53. </div>
  54.  
  55. <p>&nbsp;</p>
  56. </body>
  57. </html>

el array solo me funciona con los que tengan el pirmer valor no se por que