1. <?php
  2. include "config/conectar.php";
  3. $id = 0;
  4. $desc = "Nada";
  5. $P_C = 0;
  6. $P_V = 0;
  7. if (isset ($_POST["MODIFICAR"]))
  8. {
  9. $id = (int) $_POST["IDS"];
  10. $desc = $_POST["descripcion"];
  11. $P_C = (int) $_POST["PRE_C"];
  12. $P_V = (int) $_POST["PRE_V"];
  13. //PROCESO
  14. $sql = "UPDATE tbl_productos SET cdescripcion='$desc', cprecio_com='$P_C', cprecio_ven='$P_V' WHERE id='$id'";
  15. //ejecuta $sql
  16. $obj_conexion->query($sql);
  17. }
  18. ?>
  19. <html>
  20. <head>
  21. <title>MODIFICAR</title>
  22. <!--CSS Bootstrap-->
  23. <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
  24. </head>
  25. <body>
  26. <nav></nav>
  27. <h2>MODIFICAR PRODUCTO</h2>
  28. <form role="form" name="register" action="modificar.php" method="POST">
  29. <div class="form-group">
  30. <label for="username">ID</label>
  31. <input type="text" class="form-control" id="IDS" name="IDS">
  32. </div>
  33. <div class="form-group">
  34. <label for="username">Descripcion</label>
  35. <input type="text" class="form-control" id="descripcion" name="descripcion">
  36. </div>
  37. <div class="form-group">
  38. <label for="username">Precio_Compra</label>
  39. <input type="text" class="form-control" id="PRE_C" name="PRE_C">
  40. </div>
  41. <div class="form-group">
  42. <label for="username">Precio_Venta</label>
  43. <input type="text" class="form-control" id="PRE_V" name="PRE_V">
  44. </div>
  45. <input name = "MODIFICAR" type = "submit" id= "MODIFICAR" value="ENVIAR"/>
  46. </form>
  47. <br /><br />
  48. <a href='index.php'>[INICIO]</a>
  49. </body>
  50. </html>

modificar