Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['submit'])) {
- global $connection;
- $username = $_POST['username'];
- $password = $_POST['password'];
- $id = $_POST['id'];
- $connection = mysqli_connect('localhost', 'root', '', 'loginapp');
- if (!$connection) {
- echo "Connectie mislukt!";
- }
- $query = "DELETE FROM users ";
- $query .= "WHERE id = '$id' ";
- $result = mysqli_query($connection, $query);
- if (!$result) {
- die('Query failed ' . mysqli_error($connection));
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Login</title>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
- </head>
- <body>
- <div class="container">
- <div class="col-xs-6">
- <form action="login_delete.PHP" method="post">
- <div class="form-group">
- <label for="username">Gebruikersnaam</label>
- <input type="text" name="username" class="form-control">
- </div>
- <div class="form-group">
- <label for="password">Wachtwoord</label>
- <input type="text" name="password" class="form-control">
- </div>
- <div class="form-group">
- <select name="id" id="">
- <?php
- while ($row = mysqli_fetch_accoc($result)) {
- ?>
- <pre>
- <?php
- print_r($row);
- ?>
- </pre>
- <?php
- }
- ?>
- </select>
- <input class="btn btn-primary" type="submit" name="submit" value="DELETE ACCOUNT">
- </form>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement