Advertisement
Guest User

Untitled

a guest
Apr 15th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_POST['submit'])) {
  4. global $connection;
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7. $id = $_POST['id'];
  8.  
  9. $connection = mysqli_connect('localhost', 'root', '', 'loginapp');
  10. if (!$connection) {
  11. echo "Connectie mislukt!";
  12. }
  13.  
  14. $query = "DELETE FROM users ";
  15. $query .= "WHERE id = '$id' ";
  16.  
  17. $result = mysqli_query($connection, $query);
  18.  
  19. if (!$result) {
  20. die('Query failed ' . mysqli_error($connection));
  21. }
  22. }
  23.  
  24. ?>
  25. <!DOCTYPE html>
  26. <html lang="en">
  27. <head>
  28. <meta charset="UTF-8">
  29. <title>Login</title>
  30. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
  31. </head>
  32. <body>
  33. <div class="container">
  34. <div class="col-xs-6">
  35. <form action="login_delete.PHP" method="post">
  36. <div class="form-group">
  37. <label for="username">Gebruikersnaam</label>
  38. <input type="text" name="username" class="form-control">
  39. </div>
  40. <div class="form-group">
  41. <label for="password">Wachtwoord</label>
  42. <input type="text" name="password" class="form-control">
  43. </div>
  44. <div class="form-group">
  45.  
  46. <select name="id" id="">
  47. <?php
  48. while ($row = mysqli_fetch_accoc($result)) {
  49. ?>
  50. <pre>
  51. <?php
  52. print_r($row);
  53. ?>
  54.  
  55.  
  56. </pre>
  57. <?php
  58. }
  59. ?>
  60.  
  61.  
  62. </select>
  63. <input class="btn btn-primary" type="submit" name="submit" value="DELETE ACCOUNT">
  64. </form>
  65. </div>
  66. </div>
  67. </body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement