
14/08/2013, 16:51
|
| | Fecha de Ingreso: agosto-2013
Mensajes: 5
Antigüedad: 11 años, 7 meses Puntos: 0 | |
Respuesta: actualización de datos de mysql dentro de una tabla html ok
Código:
Código PHP:
<?phpif(isset($_POST['enviar'])){$x=$_POST['ocu'];$x=trim($x);$dbn="seguro";$tabla="segurosauto";$conexion=mysql_connect("localhost","root","") or die (mysql_error());$db=@mysql_select_db($dbn,$conexion) or die (mysql_error());
Código PHP:
$sql="Update $tabla Set estado='$_POST[est]', nombre='$_POST[nom]', vigencia='$_POST[vig]', aseguradora='$_POST[ase]', suma='$_POST[sum]', deducible='$_POST[ded]', prima='$_POST[pri]', forma='$_POST[for]', placa='$_POST[pla]', marca='$_POST[mar]', clase='$_POST[cla]', modelo='$_POST[mod]', tipo='$_POST[tip]', color='$_POST[col]', an='$_POST[a]' where poliza='$x'";$result=mysql_query($sql,$conexion);print "<h1><center><font face=\"magneto\">Se ha Modificado el Auto de forma correcta</face></h1>";}else{?>
Código HTML:
<html>
<body bgcolor="purple" alink="yellow" link="blue" vlink="white"> Código PHP: <?php$Var=$_GET['var'];$Var=trim ($Var);$dbn="seguro";$tabla="segurosauto";$conexion=mysql_connect("localhost","root","") or die (mysql_error());$db=@mysql_select_db($dbn,$conexion) or die (mysql_error());$sql="select * from $tabla where poliza='$Var'";$result=mysql_query($sql,$conexion);?> Código HTML: <form method="post" action="actualizar-cliente-auto.php">
<br><br><hr size="3" color="gray"><br><br>
<table bgcolor="#99CCCC" align="center" border="3">
<tr style="font-size:14px; ">
<td nowrap>N° de Poliza</td>
<td NOWRAP>Estado de Poliza</td>
<td nowrap>Nombre Cliente</td>
<td nowrap>Vigencia</td>
<td nowrap>Aseguradora</td>
<td nowrap>Suma asegurada</td>
<td nowrap>Deducible</td>
<td nowrap>Prima Anual</td>
<td nowrap>Forma de Pago</td>
<td nowrap>N° de Placa</td>
<td nowrap>Marca</td>
<td nowrap>Clase</td>
<td nowrap>Modelo</td>
<td nowrap>Tipo</td>
<td nowrap>color</td>
<td nowrap>año</td>
</tr> Código PHP: <?phpwhile ($row=mysql_fetch_array($result)){$x=$row["poliza"];print "<tr><td>".$row["poliza"]."</td>";print "<td><input type=\"text\" name=\"est\" value=\"".$row["estado"]."\"></td>";print "<td><input type=\"text\" name=\"nom\" value=\"".$row["nombre"]."\"></td>";print "<td><input type=\"text\" name=\"vig\" value=\"".$row["vigencia"]."\" ></td>";print "<td><input type=\"text\" name=\"ase\" value=\"".$row["aseguradora"]."\" ></td>";print "<td><input type=\"text\" name=\"sum\" value=\"".$row["suma"]."\" ></td>";print "<td><input type=\"text\" name=\"ded\" value=\"".$row["deducible"]."\" ></td>";print "<td><input type=\"text\" name=\"pri\" value=\"".$row["prima"]."\" ></td>";print "<td><input type=\"text\" name=\"for\" value=\"".$row["forma"]."\" ></td>";print "<td><input type=\"text\" name=\"pla\" value=\"".$row["placa"]."\" ></td>";print "<td><input type=\"text\" name=\"mar\" value=\"".$row["marca"]."\" ></td>";print "<td><input type=\"text\" name=\"cla\" value=\"".$row["clase"]."\" ></td>";print "<td><input type=\"text\" name=\"mod\" value=\"".$row["modelo"]."\" ></td>";print "<td><input type=\"text\" name=\"tip\" value=\"".$row["tipo"]."\" ></td>";print "<td><input type=\"text\" name=\"col\" value=\"".$row["color"]."\" ></td>";print "<td><input type=\"text\" name=\"a\" value=\"".$row["an"]."\" ></td>";print "<input type=\"hidden\" name=\"ocu\" value=\"$x\">";}mysql_free_result($result)?> Código HTML: </table>
<center><input type="submit" name="enviar" value="Actualizar"></center>
</form> Código HTML: </body>
</html>
Última edición por girl9; 14/08/2013 a las 16:58 |