Foros del Web » Programando para Internet » PHP »

combox

Estas en el tema de combox en el foro de PHP en Foros del Web. Bueos dias amigos tengo un problema combox anidados tengo una tabla en mysql llamada integrante en la cual tengo una serie de datos organizados de ...
  #1 (permalink)  
Antiguo 30/05/2008, 10:09
 
Fecha de Ingreso: septiembre-2007
Mensajes: 47
Antigüedad: 16 años, 6 meses
Puntos: 0
combox

Bueos dias

amigos

tengo un problema combox anidados
tengo una tabla en mysql llamada integrante en la cual tengo una serie de datos organizados de cuerdo al numero de cedula

yo genere este un codigo
para que cuando se cargue una pagina de consulta y me aparezcan todas las cedulas de labla en un un primer combo o lista menu, hasta va todo bien.
yo tengo un segundo combo
este combo quiero que se mantenga inactivo, hasta que alguien seleccione un numero de cedula y que este combo me muestre nombre de la persona que aquien pertenece el numero de cedula seleccionado.

este es codigo

<?php require_once('Connections/prueba.php'); ?>
<?php require_once('Connections/cedula.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db("sisbagir");
$query_Recordset1 = "SELECT integrante.cedula FROM integrante";
$Recordset1 = mysql_query($query_Recordset1, $cedula) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
<head>
<title>Documento sin título</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<label>
<select name="select" id="select">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['cedula']?>"><?php echo $row_Recordset1['cedula']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
</label>
<label><?
$select=$_REQUEST['select.value'];
$query_Recordset1 = "SELECT integrante.nombres FROM integrante where cedula='$select'";
$Recordset1 = mysql_query($query_Recordset1, $prueba) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);?>

<select name="select2" id="select2">
<?php
do {
?>
<option value="<?php echo $row_prueba['nombres']?>"<?php if (!(strcmp($row_prueba['nombres'], $row_Recordset1['nombres']))) {echo "selected="selected"";} ?>><?php echo $row_prueba['nombres']?></option>
<?php
} while ($row_prueba = mysql_fetch_assoc($prueba));
$rows = mysql_num_rows($prueba);
if($rows > 0) {
mysql_data_seek($prueba, 0);
$row_prueba = mysql_fetch_assoc($prueba);
}
?>
</select>
</label>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);

?>
  #2 (permalink)  
Antiguo 30/05/2008, 11:03
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: combox

Tema trasladado a PHP General.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:32.