Ver Mensaje Individual
  #17 (permalink)  
Antiguo 06/08/2009, 22:28
Avatar de ricardoernes
ricardoernes
 
Fecha de Ingreso: agosto-2009
Ubicación: Miranda
Mensajes: 188
Antigüedad: 15 años, 3 meses
Puntos: 4
Exclamación Respuesta: no perder datos + select onChange + mostrar otro select PHP

aki esta el codigo

Código PHP:
<?php


$cargoConsulta 
= isset($_POST['selectCargo']) ? $_POST['selectCargo']:NULL;

?>
<html>
<body>
            
                    
                    <table width="65%" border="4" align="center" bgcolor="#FFFFCC">
                    <!-- <form name="registroUsuario"  action="php/registrarUsuario.php" method="post"> -->
                      <tr>
                                    <td width="48%">
                                      
                                        C&eacute;dula
                                          <input type="text" name="cedula">
                                      </td>
                                    <td width="52%">
                                                           
                                        
                                        Password
                                          <input type="text" name="password">
                                       </td>
                      </tr>
                                  <tr>
                                    <td>Nombre
                                          <input type="text" name="nombre">
                                        <                                    </td>
                                    <td>Apellido
                                          <input type="text" name="apellido">
                                 </td>
                                  </tr>
                                  <tr>
                                    <td>
                                          Numero
                                          <input type="text"  name="opcNumero1">
                                    </td>
                                    <td>
                                    
                                      Email
                                        <input type="text" name="email">
                                    </td>
                                  </tr>
                                  <tr>
                                  
                                  
                                    <td>
                                      <form name="consultar"   action="cargarUsuario.php" method="post">
                                       Cargo
                                        <?php
                                        
                                        
if ( $_SESSION['SidUnidad'] > '1')
                                        {
                                               
//Creando la conexion
                                                
$con mysql_connect('localhost','actividad','xx');
                                                if (!
$con)
                                                    die(
"No nos dieron conexion");
                                                else
                                                {    
//seleccionando la Base de Datos Personal
                                                    
$db mysql_select_db('registro',$con);
                                                    if (!
$db)
                                                        die(
"No nos dieron la Base de Datos");
                                                    else
                                                    {
                                                        
$query "select nombre from cargo;";                                        
                                                        
                                                        
$resultado mysql_query($query,$con);
                                                        
                                                                                                    
                                                        echo
'    <select name="selectCargo" onChange="this.form.submit()">';
                                                        
                                                        if (
$_POST['selectCargo'] == "")
                                                            echo 
'<option>Seleccione:</option>';
                                                        else
                                                            echo 
'<option>'.$_POST['selectCargo'].'</option>';
                                                        
                                                        
                                                        while (
$linea mysql_fetch_array($resultado)) 
                                                        {  
                                                           if (
$_POST['selectCargo'] != $linea[0]) 
                                                           echo (
'<option value="'.$linea[0].'">'.$linea[0].'</option>');    
                                                        } 
                                                        echo
'        </select>';  

                                                            
                                                    }
                                                    
mysql_close($con);
                                                }
                                                
                                        }
//fin if de control de Unidad
                                        
else
                                            {
                                                echo
'    <select name="selectCargo" title= "para disponibilidad de los demas cargos por favor registre Unidad">';
                                                echo 
'<option>Seleccione:</option>';
                                                   echo 
'<option value="1">Jefe de Direccion</option>';    
                                                 
                                                echo
'        </select>';
                                            }
                                                
                                        
?>
                                   
                                      </form>
                                      </td>
                                    <td>
                                     
                                     Estado
                                          <input type="text" name="estado2" disabled="true" value="Activo">
                                    </td>
                                  </tr>
                                  <tr>
                                    <td>                                   
                                                                       
                                            <?php
                                            
if ($cargoConsulta != NULL && $cargoConsulta != "Jefe de Direccion")
                                                
// AKI CARGO EL OTRO SELECT
                                            
?>                
                                                               
                                    </td>
                                    <td>                                      
                                      
                                          <input name="Submit3" type="submit" class="button" value="Registrar">
                                          <input name="SubmitCancelar" type="button" class="button" value="Cancelar" onClick="location.href='submenuAdministrador.php';">
                                   </td>
                                  </tr>
     <!--</form>--> 
    </table>
        
 
</body>

</html>
ahora lo que quiero y lo que me falta es enviar esta informacion a OTRA PAG!!!!

Última edición por ricardoernes; 06/08/2009 a las 23:17