Código PHP:
<?php
echo "<br>";
$tarea=$_GET['combo'];if ($combo==0)
{
echo "<center>Registro Actualizado</center>";
}
?>
<table border="1" align="center">
<form name="form1" method="GET" onSubmit="" action="" id="form1">
<?php
include ("conexion.php");
conectar();
$consulta="select * from actividad";
$resultados= mysql_db_query ($mydb,$consulta) or die("error consulta: ".mysql_error());
$tarea = $_GET['combo'];
echo '<select name="combo" size="1" id="combo" onChange="javascript:document.form1.submit();">';
echo "<option value='0'>___</option>";
if (!(@mysql_num_rows ($resultados) == 0))
{
while ($campo = mysql_fetch_array($resultados))
{
$dependencia=$campo['dependencia'];
$tarea = $_GET['combo'];
if ($campo['id_actividad'] == $tarea){
echo "<option value='".$campo['id_actividad']."' selected>".$campo['actividad']."</option>";
}
else{
echo "<option value='".$campo['id_actividad']."'>".$campo['actividad']."</option>" ;
}
}
echo "</select>";
?>
<?php
$qry="select * from actividad where id_actividad='".$tarea."'";
$result1=mysql_query($qry);
$num=mysql_num_rows($result1);
$campo=mysql_fetch_array($result1);
?>
<?php
$consulta="select * from tareas";
$resultados= mysql_db_query ($mydb,$consulta) or die("error consulta: ".mysql_error());
$tarea = $_GET['combo'];
echo '<select name="combo" size="1" id="combo" onChange="javascript:document.form1.submit();">';
echo "<option value='0'>___</option>";
if (!(@mysql_num_rows ($resultados) == 0))
{
while ($campo = mysql_fetch_array($resultados))
{
$dependencia=$campo['dependencia'];
$tarea=$campo['tarea'];
$cod_tarea=$campo['cod_tarea'];
$f_i=$campo['f_i'];
$f_f=$campo['f_f'];
$f_f=$campo['f_f'];
$monto=$campo['monto'];
$unidad=$campo['unidad'];
$programado=$campo['programado'];
$tarea=$campo['tarea'];
$trimestres=$campo['trimestres'];
$calcular=$campo['calcular'];
$tarea = $_GET['combo'];
if ($campo['id_tarea'] == $tarea){
echo "<option value='".$campo['id_tarea']."' selected>".$campo['cod_tarea']."</option>";
}
else{
echo "<option value='".$campo['id_tarea']."'>".$campo['cod_tarea']."</option>" ;
}
}
echo "</select>";
?>
<?php
$qry="select * from tareas where id_tarea='".$tarea."'";
$result1=mysql_query($qry);
$num=mysql_num_rows($result1);
$campo=mysql_fetch_array($result1);
?>
</form>