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

insertar