Advertisement
Guest User

Untitled

a guest
Nov 7th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. if( isset($_POST['name']) && isset($_POST['lastname']) && isset($_POST['age']) &&
  6. isset($_POST['email']) && isset($_POST['gender']) && isset($_POST['username']) && isset($_POST['password'])){
  7.  
  8. $dbc_form = mysqli_connect("localhost","root","","register");
  9.  
  10. $name = $_POST['name'];
  11. $lastname = $_POST['lastname'];
  12. $age = $_POST['age'];
  13. $email = $_POST['email'];
  14. $gender = $_POST['gender'];
  15. $username = $_POST['username'];
  16. $password = $_POST['password'];
  17.  
  18. $query = "INSERT INTO register (name,lastname,age,email,gender,username,password) VALUES ('$name','$lastname','$age','$email','$gender','$username','$password');";
  19.  
  20. if(mysqli_query($dbc_form,$query)){
  21.  
  22. header("Location: index.php");
  23. }else{
  24.  
  25. $_SESSION['error_msg'] = "Upptagen mail!";
  26. header("Location: index.php");
  27. }
  28. }
  29. else{
  30. $_SESSION['error_msg'] = "Felaktig information";
  31. header("Location: index.php");
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement