PHP - combox

 
Vista:

combox

Publicado por congas1983 (29 intervenciones) el 30/05/2008 17:35:03
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);

?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder