guardar.php
Código PHP:
//combos de los demas campos, agregar a otras tablas
for($e=1;$e<=4;$e++)
{
if(($_POST['estreal'.$e] > 1) and ($_POST['arest'.$e] > 1) and ($_POST['nivest'.$e] > 1) and ($_POST['cenest1'] > 1)){
$codniv=$_POST['estreal'.$e];
//$cod2 = 'arest'.$e;
$codarea=$_POST['arest'.$e];
//$cod3 = 'nivest'.$e;
$coddur=$_POST['nivest'.$e];
//$cod4 = 'cenest'.$e;
$codcent=$_POST['cenest'.$e];
mysql_query("insert into isur_estudiosrealizados (ID_USER, ID_NESTUDIOS, ID_AESTUDIOS, ID_DESTUDIOS, ID_CESTUDIO) values('$COD','$codniv','$codarea','$coddur','$codcent')");
}else{
echo "debe singresar todos los combos para registrar tus estudios realizados fila Nº".$e."<br>";
}
}
echo "Usuario Guardado correctamente, Gracias";
print "<meta http-equiv=Refresh content=\"1 ; url=index.php?lh=78f05f6acbfb9355e9fdf541d214224a&eu=GHMO4ZbNqTLQG8\">";
?>
index.php
Código PHP:
<form action="guardar.php" method="post">
<div align="center">
<input name="Enviar" type="submit" value="Guardar" />
</div>
<div id="container-5">
<ul>
<li><a href="#fragment-datos-personales-13"><span>Datos Personales</span></a></li>
<li><a href="#fragment-14"><span>Conocimientes Tecnologicos</span></a></li>
<li><a href="#fragment-15"><span>Especializaciones</span></a></li>
</ul>
<div id="fragment-datos-personales-13">
<table width="81%">
<col width="13%">
<col width="1%">
<col width="36%">
<col width="0%">
<col width="13%">
<col width="1%">
<col width="36%">
.
.
.
.
.
.
.
.
$queryion="select ID_USER, ID_NESTUDIOS, ID_AESTUDIOS, ID_DESTUDIOS, ID_CESTUDIO from isur_estudiosrealizados where ID_USER=$id";
$resultaon=mysql_query($queryion,$db);
while ($Campos=mysql_fetch_array($resultaon)){
for($e=1;$e<=4;$e++){
if ($e==1) {
$estrea1[$e]=$Campos['ID_NESTUDIOS'];
$arest1[$e]=$Campos['ID_AESTUDIOS'];
$nivest1[$e]=$Campos['ID_DESTUDIOS'];
$cenest1[$e]=$Campos['ID_CESTUDIO'];
} else if ($e==2) {
$estrea2[$e]=$Campos['ID_NESTUDIOS'];
$arest2[$e]=$Campos['ID_AESTUDIOS'];
$nivest2[$e]=$Campos['ID_DESTUDIOS'];
$cenest2[$e]=$Campos['ID_CESTUDIO'];
} else if ($e==3) {
$estrea3[$e]=$Campos['ID_NESTUDIOS'];
$arest3[$e]=$Campos['ID_AESTUDIOS'];
$nivest3[$e]=$Campos['ID_DESTUDIOS'];
$cenest3[$e]=$Campos['ID_CESTUDIO'];
} else if ($e==4) {
$estrea4[$e]=$Campos['ID_NESTUDIOS'];
$arest4[$e]=$Campos['ID_AESTUDIOS'];
$nivest4[$e]=$Campos['ID_DESTUDIOS'];
$cenest4[$e]=$Campos['ID_CESTUDIO'];
}
}
}
//mysql_free_result($resultaon);
for($e=1;$e<=4;$e++){
?> <!-- Incrementa frame -->
<tr>
<td><select name="<?php echo "estreal".$e; ?>" id="<?php echo "estreal".$e; ?>" >
<?php
$querya="SELECT * FROM isur_nestudios";
$resulta=mysql_query($querya,$db);
while ($row=mysql_fetch_array($resulta)){
if($e==1){$ddd1=$estrea1[1];}else if($e==2){$ddd1=$estrea2[2];}else if($e==3){$ddd1=$estrea3[3];}else{$ddd1=estrea4;}
if($ddd1==$Campos['ID_NESTUDIOS']){$selec1="selected";}else{$selec1="";}?>
<option value="<?php echo $row['ID_NESTUDIOS']; ?>" <?php echo $selec1; ?>><?php echo $row['NameNEstudios']; ?></option>
<?php } ?>
</select></td>
<td><select name="<?php echo "arest".$e; ?>" id="<?php echo "arest".$e; ?>" >
<?php
$queryb="SELECT * FROM isur_aestudios";
$resultb=mysql_query($queryb,$db);
while ($row=mysql_fetch_array($resultb)){
if($e==1){$ddd2=$arest1;}else if($e==2){$ddd2=$arest2;}else if($e==3){$ddd2=$arest3;}else{$ddd2=$arest4;}
if($ddd2==$row['ID_AESTUDIOS']){$selec2="selected";}else{$selec2="";}?>
<option value="<?php echo $row['ID_AESTUDIOS']; ?>" <?php echo $selec2; ?>><?php echo $row['NameAEstudios']; ?></option>
<?php } ?>
</select></td>
<td><select name="<?php echo "nivest".$e; ?>" id="<?php echo "nivest".$e; ?>" >
<?php
$queryc="SELECT * FROM isur_destudios";
$resultc=mysql_query($queryc,$db);
while ($row=mysql_fetch_array($resultc)){
if($e==1){$ddd3=$nivest1;}else if($e==2){$ddd3=$nivest2;}else if($e==3){$ddd3=$nivest3;}else{$ddd3=$nivest4;}
if($ddd3==$row['ID_DESTUDIOS']){$selec3="selected";}else{$selec3="";}?>
<option value="<?php echo $row['ID_DESTUDIOS']; ?>" <?php echo $selec3; ?>><?php echo $row['NameDEstudios']; ?></option>
<?php } ?>
<select></td>
<td><select name="<?php echo "cenest".$e; ?>" id="<?php echo "cenest".$e; ?>" >
<?php
$queryd="SELECT * FROM isur_centroestudios";
$resultd=mysql_query($queryd,$db);
while ($row=mysql_fetch_array($resultd)){
if($e==1){$ddd4=$cenest1;}else if($e==2){$ddd4=$cenest2;}else if($e==3){$ddd4=$cenest3;}else{$ddd4=$cenest4;}
if($ddd4==$row['ID_CESTUDIO']){$selec4="selected";}else{$selec4="";}?>
<option value="<?php echo $row['ID_CESTUDIO']; ?>" <?php echo $selec4; ?>><?php echo $row['DescripcionCEstudio']; ?></option>
<?php } ?>
</select></td>
</tr>
<?php } // for sentencia ?>
</table>
</div>
<br/>
</fieldset>
<br>
<fieldset>
esto es lo que toy tratando de hacer para mostrar los los resultados del combo guardado, a ver si con esto alguien se digna y se compadece a responder con algun aporte, desde ya cualquier idea aporte sera bien recibido..je
salu2