Guest User

Untitled

a guest
May 29th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <body>
  2.  
  3. <form action="" method"post" class="form">
  4. <div class="form-group1">
  5. <label for="" >Username :</label>
  6. <input type="text" class="form-control" name="username" id="tb-username" placeholder="Username">
  7. </div>
  8. <div class="form-group2">
  9. <label for="" >Password :</label>
  10. <input type="password" class="form-control" name="password" id="tb-password" placeholder="Password">
  11. </div>
  12. <button type="submit" class="btn btn-primary" id="btn-submit" name="register">Submit</button>
  13. </form>
  14.  
  15. <?php
  16.  
  17. if(isset($_POST['register']))
  18. {
  19. if(isset($_POST['username'], $_POST['password']))
  20. {
  21. $username = $_POST['username'];
  22. $password = $_POST['password'];
  23.  
  24. $link = mysqli_connect("localhost", "root", " ", "vbproject");
  25.  
  26. if(mysqli_connect_errno())
  27. {
  28. printf("Connect failed: %sn", mysqli_connect_errno());
  29. exit();
  30. }
  31.  
  32. $sql = "INSERT INTO users (username, password)
  33. VALUES('$username', '$password')";
  34.  
  35. mysqli_close($link);
  36. }
  37. }
  38. ?>
  39.  
  40. </body>
Add Comment
Please, Sign In to add comment