Guest User

Untitled

a guest
May 20th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="ru">
  3. <head>
  4. <title>Админ-панель</title>
  5. </head>
  6. <body>
  7. help me
  8. <form method="POST"><p>Введите имя таблицы</p>
  9. <input type="text" name="table">
  10. <p>Введите id телефона</p>
  11. <input type="number" name="id">
  12. <p>Введите цену</p>
  13. <input type="number" name="price">
  14. <button type="submit"></button>
  15. </form>
  16.  
  17. <?php
  18. require '../connect.php';
  19.  
  20. if(isset($_POST['price']) && isset($_POST['table']) && isset($_POST['id'])){
  21.  
  22. $id = htmlentities(mysqli_real_escape_string($connection, $_POST['id']));
  23. $price = htmlentities(mysqli_real_escape_string($connection, $_POST['price']));
  24. $table = htmlentities(mysqli_real_escape_string($connection, $_POST['table']));
  25.  
  26. $query ="UPDATE $table SET price = '$price' WHERE id = $id";
  27. $result = mysqli_query($connection, $query) or die("Ошибка " . mysqli_error($connection));
  28.  
  29. if($result)
  30. echo "<span style='color:blue;'>Данные обновлены</span>";
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37. ?>
Add Comment
Please, Sign In to add comment