Foros del Web » Programando para Internet » PHP »

como enviar varios formulario a una tabla en php y mysql

Estas en el tema de como enviar varios formulario a una tabla en php y mysql en el foro de PHP en Foros del Web. hola que tal necesito enviar varios formularios al mismo tiempo a una tabla en php y mysql es ovbio que un formulario es desde que ...
  #1 (permalink)  
Antiguo 22/03/2011, 08:27
 
Fecha de Ingreso: diciembre-2010
Mensajes: 11
Antigüedad: 13 años, 4 meses
Puntos: 0
como enviar varios formulario a una tabla en php y mysql

hola que tal necesito enviar varios formularios al mismo tiempo a una tabla en php y mysql es ovbio que un formulario es desde que habres un form hasta que lo cierras.

el detalle es este que hago una consulta de todos los registros que tengo en una tabla y todos los pongo dentro de un formulario en forma de listas o sea todos los registros de una tabla y kiero actualizarlos y darlo a un solo boton submit para que los registros que yo actualize pues se actualizen con solo darle a un boton a contunuacion pongo mi codico

aqui coloco la consulta de todos los registros

Código PHP:
<style type="text/css"> 
table.fija
{
table-layout:fixed
}
</style>
<!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=utf-8" />
<title>Documento sin título</title>
</head>

<body>
<table width="100%" border="1"  class="fija">
  <tr>
    <td width="5%">MATRIC</td>
    <td width="25%">NOMBRE</td>
    <td width="5%">CALIF1</td>
    <td width="5%">CALIF2</td>
    <td width="5%">CALIF3</td>
    <td width="5%">CALIF4</td>
    <td width="5%">CALIF5</td>
    <td width="5%">CALIF6</td>
    <td width="5%">CALIF7</td>
    <td width="5%">CALIF8</td>
    <td width="5%">CALIF9</td>
    <td width="5%">CALIF</td>
    <td width="5%">PROM</td>
  </tr>
  </table>


<?PHP
include("../Connections/conectar.php");
$db=mysql_select_db("control_escolar"$conexion);

$sql='select calificaciones.*, alumnos.* from calificaciones left join alumnos on calificaciones.MATRICULA_ALU=alumnos.MATRICULA WHERE MATRICULA_ALU=05300041';

$result=mysql_query($sql$conexion);
//echo '<form action="INSERTAR_CALIF.php" name="" method="post">';
while($row=mysql_fetch_array($result))
{
  
?>
<form action="INSERTAR_CALIF.php" name="" method="post">
<table width="100%" border="1" class="fija">
    <td width="5%"><input name="MATRICULA" type="text"  value="<?php echo $row['MATRICULA_ALU']?>" size="10" readonly="readonly"/></td>
    <td width="25%"><?php echo $row['APELLIDOS']?><?php echo $row['NOMBRES']?></td>
    <td width="5%"><input name="PARC1" type="text" value="<?php echo $row['PARC1']?>" size="5" /></td>
    <td width="5%"><input name="PARC2" type="text" value="<?php echo $row['PARC2']?>" size="5"/></td>
    <td width="5%"><input name="PARC3" type="text" value="<?php echo $row['PARC3']?>" size="5"/></td>
    <td width="5%"><input name="PARC4" type="text" value="<?php echo $row['PARC4']?>" size="5"/></td>
    <td width="5%"><input name="PARC5" type="text" value="<?php echo $row['PARC5']?>" size="5"/></td>
    <td width="5%"><input name="PARC6" type="text" value="<?php echo $row['PARC6']?>" size="5"/></td>
    <td width="5%"><input name="PARC7" type="text" value="<?php echo $row['PARC7']?>" size="5"/></td>
    <td width="5%"><input name="PARC8" type="text" value="<?php echo $row['PARC8']?>" size="5"/></td>
    <td width="5%"><input name="PARC9" type="text" value="<?php echo $row['PARC9']?>" size="5"/></td>
    <td width="5%"><input name="PARC10" type="text" value="<?php echo $row['PARC10']?>" size="5" border="4"/></td>
    <td width="5%">&nbsp;</td>
  </table>
  <input type="hidden" name="CLAVE_PROF" value="<?php echo $row['CLAVE_PROF']?>" readonly="readonly" />
  
  

<?php
}
mysql_free_result($result);
echo 
'<input type="submit" value="GUARDAR" name="GUARDAR">';
echo 
'</form>';
?>


</body>
</html>

y aqui mando actualizar


Código PHP:
<?PHP
include("../Connections/conectar.php");
mysql_select_db("control_escolar"$conexion);

$MATRICULA=$_POST['MATRICULA'];
$PARC1=$_POST['PARC1'];
$PARC2=$_POST['PARC2'];
$PARC3=$_POST['PARC3'];
$PARC4=$_POST['PARC4'];
$PARC5=$_POST['PARC5'];
$PARC6=$_POST['PARC6'];
$PARC7=$_POST['PARC7'];
$PARC8=$_POST['PARC8'];
$PARC9=$_POST['PARC9'];
$PARC10=$_POST['PARC10'];
$CLAVE=$_POST['CLAVE_PROF'];

$sql='update calificaciones set PARC1="'.$PARC1.'", PARC2="'.$PARC2.'", PARC3="'.$PARC3.'", PARC4="'.$PARC4.'", PARC5="'.$PARC5.'", PARC6="'.$PARC6.'",PARC7="'.$PARC7.'", PARC8="'.$PARC8.'", PARC9="'.$PARC9.'", PARC10="'.$PARC10.'" where MATRICULA_ALU="'.$MATRICULA.'" AND CLAVE_PROF="'.$CLAVE.'"  ';

if(
$result=mysql_query($sql$conexion))
{
    echo 
"datos insertados";
    echo 
"<br>";
    echo 
"$MATRICULA";
    echo 
"<br>";
    echo 
"$PARC1";
    echo 
"<br>";
    echo 
"$PARC2";
    echo 
"<br>";
    echo 
"$PARC3";
    echo 
"<br>";
    echo 
"$PARC4";
    echo 
"<br>";
    echo 
"$PARC5";
    echo 
"<br>";
    echo 
"$PARC6";
    echo 
"<br>";
    echo 
"$PARC7";
    echo 
"<br>";
    echo 
"$PARC8";
    echo 
"<br>";
    echo 
"$PARC9";
    echo 
"<br>";
    echo 
"$PARC10";
    echo 
"<br>";
    
}


?>
  #2 (permalink)  
Antiguo 22/03/2011, 09:12
Avatar de maycolalvarez
Colaborador
 
Fecha de Ingreso: julio-2008
Ubicación: Caracas
Mensajes: 12.120
Antigüedad: 15 años, 9 meses
Puntos: 1532
Respuesta: como enviar varios formulario a una tabla en php y mysql

no te entiendo, quieres enviar varios forms, pero yo solo veo 1?????
__________________
¡Por favor!: usa el highlight para mostrar código
El que busca, encuentra...
  #3 (permalink)  
Antiguo 22/03/2011, 09:35
 
Fecha de Ingreso: diciembre-2010
Mensajes: 11
Antigüedad: 13 años, 4 meses
Puntos: 0
Respuesta: como enviar varios formulario a una tabla en php y mysql

si te das cuanta es una consulta y esta puesto en array y ponetodos los regitros en una pagina
y a al hora de guardar quiero que con un solo submit lo envie

Etiquetas: mysql, tablas, formulario
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:01.