daily pastebin goal
12%
SHARE
TWEET

editarproducto.php

a guest May 16th, 2018 104 in 19 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. if ($_REQUEST['nombre'])
  3. {
  4. include "conexion.php";
  5. $imagen =addslashes(file_get_contents ($_FILES['imagen']['tmp_name']));
  6. $sql="update productos set nombre='$_REQUEST[nombre]',precio='$_REQUEST[precio]',stock='$_REQUEST[stock]',imagen='$imagen' where id=$_REQUEST[id]";
  7. $columna=$fila1['column_name'];
  8.  
  9. print $sql;
  10. $db->query($sql);
  11. //header ("Location: productos.php");
  12. exit;
  13. }
  14. include "menu.php";
  15. $sql1 = "select * from productos where id=$_REQUEST[id]";
  16. $resultado1 = $db->query($sql1);
  17. $fila1 = $resultado1->fetch_assoc();
  18.  
  19. print "<h4 align=left>Editar: Productos</h4>
  20. <div class=col-md-6><br>
  21. <form method='post' enctype='multipart/form-data'>
  22. <label>Nombre:</label><input class=form-control type=text name=nombre required value='$fila1[nombre]'><br>
  23. <label>Precio:</label><input class=form-control type=text name=precio value='$fila1[precio]' required><br>
  24. <label>Stock:</label><input class=form-control type=text name=stock value='$fila1[stock]' required><br>";
  25.  
  26. print "<label>Imagen:</label><input class=form-control type=file name=imagen>";
  27. print "<img class='img-responsive' src=" . '"' . "data:image/jpeg;base64," .base64_encode($fila1['imagen']) . '"' . "/>";
  28.  
  29.  
  30. print "<br><input type=hidden name=Id value=$fila1[Id]><br>
  31. <input type=submit class='btn btn-primary'>
  32. </form>
  33. </div>";
  34. include "pie.php";
  35. ?>
RAW Paste Data
Top