Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/06/2012, 17:37
Avatar de lskycito
lskycito
 
Fecha de Ingreso: agosto-2011
Mensajes: 3
Antigüedad: 13 años, 6 meses
Puntos: 0
Información problema suma de textbox en table

Necesito ayuda con el codigo para generar que al momento de hacer click en el boton de calcular promedio, capture los valores de los textbox en los td por cada fila y los muestre en el textbox promedio

Aqui esta el codigo adjunto

Código PHP:
<?php
//lista.php
require("conexion.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title></head>
<body >
<p>
  <?php
$sql
="select coduniv,nombre_completo from estudiante";
$resultado=$cnx->query($sql) or die($cnx->error);
$numreg=$resultado->num_rows;
?>
  <?php
$sql
="select idcalificacion,nombre_calificacion,peso from calificacion";
$resultado2=$cnx->query($sql) or die($cnx->error);
$numreg2=$resultado2->num_rows;
?>
<h1 align="center"><strong>Registro de notas </strong><br />
</h1>
<form action="eliminar.php" method="post">
  <table  border=2  align="center">
    <tr>
      <th >Id</th>
      <th >Responsable</th>
       <?php
while($registro2=$resultado2->fetch_object()){?>
      <th width="69"><?php echo $registro2->nombre_calificacion?></th>
    <?php ?>
      <th width="90">Promedio</th>
    </tr>
    <?php
while($registro=$resultado->fetch_object()){?>
    <tr>
    <th><?php echo $registro->coduniv?></td>
      <th><?php echo $registro->nombre_completo?></td>
      <?php
      
for($i=1;$i<=$numreg2;$i++){
      echo 
"<td><input type='text' size='2' maxlength='3' name=$i></td>";
}
?>
<td align="center"><input type="text" size="2" maxlength="3" name="promedio" border="0" style="border:thin" disabled="disabled" ></td>
</tr>
    <?php ?>
      </table>
  <p align="center"><input name="calcular" type="button" value="Calcular Promedios" /><input name="guardar" type="button" value="Guardar Notas" /></p>
</form>
<b><p>
Alumnos Encontrados <?php echo $numreg?></p></b>

</body>
</html>

Última edición por lskycito; 21/06/2012 a las 17:42 Razón: adjuntar imagen