Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/09/2009, 18:29
visona
 
Fecha de Ingreso: febrero-2008
Mensajes: 675
Antigüedad: 16 años, 4 meses
Puntos: 5
Respuesta: Actualizar un campo segun el select

Este es el formulario que tengo
Código PHP:
<form ACTION="<?php echo $loginFormAction?>" method="POST" name="acceso" class="Estilo1" id="acceso">
  <table width="550" border="0" align="center">
    <tr>
      <td width="19">&nbsp;</td>
      <td width="218"><h3 class="Estilo1">Usuario:</h3></td>
      <td width="299"><h3 class="Estilo1">
        <label>
        [COLOR="Red"]<select name="usu" id="usu">[/COLOR]
          <?php
do {  
?><option value="<?php echo $row_usuar['entrada']?>"><?php echo $row_usuar['empleado']?></option>
          <?php
} while ($row_usuar mysql_fetch_assoc($usuar));
  
$rows mysql_num_rows($usuar);
  if(
$rows 0) {
      
mysql_data_seek($usuar0);
      
$row_usuar mysql_fetch_assoc($usuar);
  }
?>
        </select>
        </label>
        <label>
        [COLOR="YellowGreen"]<input name="nivel" type="text" id="nivel" value="<?php echo $row_usuar['nivel']; ?>" size="2" />[/COLOR]
        </label>
      </h3></td>
    </tr>
    <tr>
      <td height="29">&nbsp;</td>
      <td><h3 class="Estilo1">Contraseña:</h3></td>
      <td><h3 class="Estilo1">
        <input name="con" type="password" class="tex_16_titulo" id="con" size="40" />
      </h3></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td class="Estilo1">Salón</td>
      <td><label>
        <select name="sesionsalon" class="Estilo1" id="sesionsalon">
          <?php
do {  
?><option value="<?php echo $row_lsalon['id_salon']?>"><?php echo $row_lsalon['salon']?></option>
          <?php
} while ($row_lsalon mysql_fetch_assoc($lsalon));
  
$rows mysql_num_rows($lsalon);
  if(
$rows 0) {
      
mysql_data_seek($lsalon0);
      
$row_lsalon mysql_fetch_assoc($lsalon);
  }
?>
        </select>
      </label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><h3>&nbsp;</h3></td>
      <td><h3>
        <label>
        <input name="button" type="submit" class="boton" id="button" value="Acceder al sistema" />
        </label>
      </h3></td>
    </tr>
  </table>
</form>
El marcado en rojo (usu) me coge los valores, luego el marcado en verde es donde deberia de salir el valor segun el select.
Por ejemplo:
En el select me lista 15 nombre de la tabla usuarios, esa tabla tiene tambien el campo NIVEL y el campo SALON.
La tabla estaria asi:
usuario:Miguel Password: xxxxxx Nivel:1 Salon: 3
usuario:pepe Password: xxxxxx Nivel:2 Salon: 2
usuario:Manolo Password: xxxxxx Nivel:1 Salon: 3
usuario:Pepa Password: xxxxxx Nivel:3 Salon: 1

Pues me gustaria que al seleccionar el marcado en rojo (usu) me pusiera el NIvel en el campo Nivel, y el salon en el campo salon del usuario que se ha seleccionado.
Gracias por vuestra ayuda y si me podeis ayudar a colocar el codigo, mejor que mejor.
Un saludo