Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Check input errors before inserting in database
- if(empty($username_err) && empty($password_err) && empty($Email_err) && empty($Phone_err) && empty($Address_err) && empty($confirm_password_err)){
- // Prepare an insert statement
- $sql = "INSERT INTO Staff (username,password,Email,Phone,Address) VALUES (?, ?,?,?,?)";
- if($stmt = mysqli_prepare($link, $sql)){
- // Bind variables to the prepared statement as parameters
- mysqli_stmt_bind_param($stmt, "sssss", $param_username, $param_password,$param_Email,$param_Phone,$param_Address);
- // Set parameters
- $param_username = $username;
- $param_password = password_hash($password, PASSWORD_DEFAULT); // Creates a password hash
- $param_username = $Email;
- $param_username = $Phone;
- $param_username = $Address;
- // Attempt to execute the prepared statement
- if(mysqli_stmt_execute($stmt)){
- // Redirect to login page
- header("location: login.php");
- } else{
- echo "Something went wrong. Please try again later.";
- }
- }
- // Close statement
- mysqli_stmt_close($stmt);
- }
- // Close connection
- mysqli_close($link); } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement