ejemplo:
PROMEDIO=(PRO_IO+PRO_IPC+PRO_EO+PRO_LAB+PRO_PROY)/5
tengo este código, quisiera agregar en el from "actualiza ep" el promedio de las notas que ingreso en cada select.
Código PHP:
<form name="actualiza_ep" method="post" action="actualiza_ep_prom.php" style=" font-size:9px; font-family:Verdana, Arial 'Arial Black', Gadget, sans-serif, Helvetica, sans-serif;">
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<td cellpading="4" > <div align="center"> <button type="submit" class="btn btn-info btn-mini"><font color="#000000" size="2"><strong>Guardar N° <?php echo $num;?></strong></font></button></div> </td>
<td cellpading="4" > <?php $color = "red";
if($row['PRO_IO']>= 11){
$color = "blue";
}?> <div align="center"> <select name= "nota_pro_io" style=" font-size:13px; font-family:Verdana, Arial 'Arial Black', Gadget, sans-serif, Helvetica, sans-serif; height:17px; overflow:scroll;height:24px;width:55px; color:<?php echo $color;?>" id= "nota_pro_io">
<?php foreach ( $nota_pro_io as $key => $value) {
?>
<option value='<?php echo $key; ?>'><?php echo $value;?></option>
<?php
# code...
}
?>
</select><div align="center"><input type="hidden" name= "io_numero"
<?php
foreach ( $io_numero as $key => $value) {
?>
value='<?php echo $key; ?>'
<?php
# code...
}
?>> </div> </td>
<td cellpading="4" > <?php $color = "red";
if($row['PRO_IPC'] >= 11){
$color = "blue";
}?><div align="center" style='color:<?php echo $color; ?>'>
<select name= "nota_pro_ipc" style=" font-size:13px; font-family:Verdana, Arial 'Arial Black', Gadget, sans-serif, Helvetica, sans-serif; height:17px; overflow:scroll;height:24px;width:55px; color:<?php echo $color; ?>" id= "nota_pro_ipc">
<?php
foreach ( $nota_pro_ipc as $key => $value) {
?>
<option value='<?php echo $key;?>'><?php echo $value;?></option>
<?php
# code...
}
?>
</select>
<div align="center"><input type="hidden" name= "ipc_numero"
<?php
foreach ( $ipc_numero as $key => $value) {
?>
value='<?php echo $key;?>'
<?php
# code...
}
?>>
</div></div></td>
<td cellpading="4" >
<?php $color = "red";
if($row['PRO_EO'] >= 11){
$color = "blue";
}?><div align="center"><select name= "nota_pro_eo" style=" font-size:13px; font-family:Verdana, Arial 'Arial Black', Gadget, sans-serif, Helvetica, sans-serif; height:17px; overflow:scroll;height:24px;width:55px; color:<?php echo $color;?>" id= "nota_pro_eo">
<?php
foreach ( $nota_pro_eo as $key => $value) {
?>
<option value='<?php echo $key;?>'><?php echo $value;?></option>
<?php
# code...
}
?>
</select><div align="center"><input type="hidden" name= "eo_numero"
<?php
foreach ( $eo_numero as $key => $value) {
?>
value='<?php echo $key;?>'
<?php
# code...
}
?>>
</div>
</td>
<td cellpading="4" > <?php $color1 = "red";
if($row['PRO_PROY'] >= 11){
$color1 = "blue";
}?><div align="center"><select name= "nota_pro_proy" style=" font-size:13px; font-family:Verdana, Arial 'Arial Black', Gadget, sans-serif, Helvetica, sans-serif; height:17px; overflow:scroll;height:24px;width:55px; color:<?php echo $color1;?>" id= "nota_pro_proy">
<?php
foreach ( $nota_pro_proy as $key => $value) {
?>
<option value='<?php echo $key;?>'><?php echo $value;?></option>
<?php
# code...
}
?>
</select><div align="center"><input type="hidden" name= "proy_numero"
<?php
foreach ( $proy_numero as $key => $value) {
?>
value='<?php echo $key;?>'
<?php
# code...
}
?>>
</div></td>
<td cellpading="4"> <?php $color1 = "red";
if($row['PRO_LAB'] >= 11){
$color1 = "blue";
}?><div align="center">
<select name= "nota_pro_lab" style=" font-size:13px; font-family:Verdana, Arial 'Arial Black', Gadget, sans-serif, Helvetica, sans-serif; height:17px; overflow:scroll;height:24px;width:55px; color:<?php echo $color1;?>" id= "nota_pro_lab">
<?php
foreach ( $nota_pro_lab as $key => $value) {
?>
<option value='<?php echo $key;?>'><?php echo $value;?></option>
<?php
# code...
}
?>
</select>
<div align="center"><input type="hidden" name= "lab_numero"
<?php
foreach ( $lab_numero as $key => $value) {
?>
value='<?php echo $key;?>'
<?php
# code...
}
?>>
</div> </td>
<input type= "hidden" name= "profesor" value = '<?php echo $profesor; ?>' >
<input type= "hidden" name= "id_salon" value = '<?php echo $id_salon; ?>' >
<input type= "hidden" name= "cod_alum" value = '<?php echo $row ['cod_alum']; ?>' >
</form>
este es mi código que guarda los datos
Código PHP:
$io_numero = $_POST['io_numero'];
$ipc_numero = $_POST['ipc_numero'];
$eo_numero = $_POST['eo_numero'];
$lab_numero = $_POST['lab_numero'];
$proy_numero = $_POST['proy_numero'];
$nota_pro_io = $_POST['nota_pro_io'];
$nota_pro_ipc = $_POST['nota_pro_ipc'];
$nota_pro_eo = $_POST['nota_pro_eo'];
$nota_pro_lab = $_POST['nota_pro_lab'];
$nota_pro_proy = $_POST['nota_pro_proy'];
$id = $_POST['id'];
$id_salon = $_POST['id_salon'];
$profesor = $_POST['profesor'];
$cod_alum = $_POST['cod_alum'];
//$query="SELECT * FROM asistencia_ura WHERE id = ".$id." AND id_curso = '".$id_salon."' AND usu_docente = '".$profesor."' AND ccodalum = ".$ccodalum." ";
$query="UPDATE eval_permanente set ".$io_numero." = '".$nota_pro_io."', ".$ipc_numero." = '".$nota_pro_ipc."', ".$eo_numero." = '".$nota_pro_eo."', ".$lab_numero." = '".$nota_pro_lab."', ".$proy_numero." = '".$nota_pro_proy."' WHERE id = ".$id." AND id_curso = '".$id_salon."' AND usu_docente = '".$profesor."' AND cod_alum = ".$cod_alum." ";
if(mysql_query($query))
{
mysql_close();
header('Location: eval_permanente.php?salon='.$id_salon);
}
else
{
mysql_close();
echo "ERROR AL ACTUALIZAR";
}