Advertisement
Guest User

login_update.php

a guest
Feb 14th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.46 KB | None | 0 0
  1. <?php include "db.php"; ?>
  2. <?php include "functions.php"; ?>
  3.  
  4. <?php
  5.  
  6. if(isset($_POST['submit'])) {
  7. global $connection;
  8. $username = $_POST['username'];
  9. $password = $_POST['password'];
  10. $id = $_POST['id'];
  11.  
  12. $query = "UPDATE users SET ";
  13. $query .= "username = '$username', ";
  14. $query .= "password = '$password', ";
  15. $query .= "WHERE id = '$id', ";
  16.  
  17.     $result = mysqli_query($connection, $query);
  18.     if(!$result) {
  19.  
  20.         die("QUERY FAILED MAN" . mysqli_error($connection));
  21.  
  22.     }
  23. }
  24.  
  25. ?>
  26.  
  27.  
  28. <!DOCTYPE HTML>
  29. <html lang="en-US">
  30. <head>
  31.     <meta charset="UTF-8">
  32.     <title></title>
  33.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  34. </head>
  35. <body>
  36.    
  37. <div class="container">
  38.  
  39. <div class="col-sm-6">
  40.  
  41.     <form action="login_update.php" method="post">
  42.         <div class="form-group">
  43.         <label for="username">Username</label>
  44.         <input type="text" name="username" class="form-control">
  45.         </div>
  46.  
  47.         <div class="form-group">
  48.         <label for="password">Password</label>
  49.         <input type="password" name="password" class="form-control">
  50.         </div>
  51.  
  52.         <div class="form-group">
  53.  
  54.         <select name="id" id="">
  55.    
  56.     <?php
  57.  
  58.         showAllData();
  59.  
  60.     ?>
  61.            
  62.  
  63.         </select>
  64.  
  65.         </div>
  66.  
  67.         <input class="btn btn-primary" type="submit" name="submit" value="Update">
  68.                
  69.  
  70.  
  71.     </form>
  72.  
  73.  
  74. </div>
  75.  
  76. </div>
  77.  
  78.  
  79.  
  80.  
  81. </body>
  82. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement