Ver Mensaje Individual
  #6 (permalink)  
Antiguo 15/08/2013, 14:19
girl9
 
Fecha de Ingreso: agosto-2013
Mensajes: 5
Antigüedad: 10 años, 8 meses
Puntos: 0
Respuesta: actualización de datos de mysql dentro de una tabla html

Cita:
Iniciado por guardarmicorreo Ver Mensaje
perdón, por twitear puse hashtag, quise decir highlight.
jeje ok

Código PHP:
Ver original
  1. <?php
  2. if(isset($_POST['enviar']))
  3. {
  4. $x=$_POST['ocu'];
  5. $x=trim($x);
  6. $dbn="seguro";
  7. $tabla="segurosauto";
  8. $conexion=mysql_connect("localhost","root","") or die (mysql_error());
  9. $db=@mysql_select_db($dbn,$conexion) or die (mysql_error());
  10.  
  11. $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'";
  12. $result=mysql_query($sql,$conexion);
  13. print "<h1><center><font face=\"magneto\">Se ha Modificado el Auto de forma correcta</face></h1>";
  14. }
  15. else
  16. {
  17. ?>
  18. <html>
  19. <body bgcolor="purple" alink="yellow" link="blue" vlink="white">
  20. <?php
  21. $Var=$_GET['var'];
  22. $Var=trim ($Var);
  23. $dbn="seguro";
  24. $tabla="segurosauto";
  25. $conexion=mysql_connect("localhost","root","") or die (mysql_error());
  26. $db=@mysql_select_db($dbn,$conexion) or die (mysql_error());
  27. $sql="select * from $tabla where poliza='$Var'";
  28. $result=mysql_query($sql,$conexion);
  29. ?>
  30. <form method="post" action="actualizar-cliente-auto.php">
  31. <br><br><hr size="3" color="gray"><br><br>
  32. <table bgcolor="#99CCCC" align="center" border="3">
  33. <tr style="font-size:14px; ">
  34. <td nowrap>N&deg; de Poliza</td>
  35. <td NOWRAP>Estado de Poliza</td>
  36. <td nowrap>Nombre Cliente</td>
  37. <td nowrap>Vigencia</td>
  38. <td nowrap>Aseguradora</td>
  39. <td nowrap>Suma asegurada</td>
  40. <td nowrap>Deducible</td>
  41. <td nowrap>Prima Anual</td>
  42. <td nowrap>Forma de Pago</td>
  43. <td nowrap>N&deg; de Placa</td>
  44. <td nowrap>Marca</td>
  45. <td nowrap>Clase</td>
  46. <td nowrap>Modelo</td>
  47. <td nowrap>Tipo</td>
  48. <td nowrap>color</td>
  49. <td nowrap>a&ntilde;o</td>
  50. </tr>
  51. <?php
  52. while ($row=mysql_fetch_array($result))
  53. {
  54. $x=$row["poliza"];
  55. print "<tr><td>".$row["poliza"]."</td>";
  56. print "<td><input type=\"text\" name=\"est\" value=\"".$row["estado"]."\"></td>";
  57. print "<td><input type=\"text\" name=\"nom\" value=\"".$row["nombre"]."\"></td>";
  58. print "<td><input type=\"text\" name=\"vig\" value=\"".$row["vigencia"]."\" ></td>";
  59. print "<td><input type=\"text\" name=\"ase\" value=\"".$row["aseguradora"]."\" ></td>";
  60. print "<td><input type=\"text\" name=\"sum\" value=\"".$row["suma"]."\" ></td>";
  61. print "<td><input type=\"text\" name=\"ded\" value=\"".$row["deducible"]."\" ></td>";
  62. print "<td><input type=\"text\" name=\"pri\" value=\"".$row["prima"]."\" ></td>";
  63. print "<td><input type=\"text\" name=\"for\" value=\"".$row["forma"]."\" ></td>";
  64. print "<td><input type=\"text\" name=\"pla\" value=\"".$row["placa"]."\" ></td>";
  65. print "<td><input type=\"text\" name=\"mar\" value=\"".$row["marca"]."\" ></td>";
  66. print "<td><input type=\"text\" name=\"cla\" value=\"".$row["clase"]."\" ></td>";
  67. print "<td><input type=\"text\" name=\"mod\" value=\"".$row["modelo"]."\" ></td>";
  68. print "<td><input type=\"text\" name=\"tip\" value=\"".$row["tipo"]."\" ></td>";
  69. print "<td><input type=\"text\" name=\"col\" value=\"".$row["color"]."\" ></td>";
  70. print "<td><input type=\"text\" name=\"a\" value=\"".$row["an"]."\" ></td>";
  71. print "<input type=\"hidden\" name=\"ocu\" value=\"$x\">";
  72. }
  73. ?>
  74. </table>
  75. <center><input type="submit" name="enviar" value="Actualizar"></center>
  76. </form>
  77. <?php
  78. }
  79. ?>
  80. </body>
  81. </html>