简体   繁体   中英

How do i pass the username & email input from the registration page to the login page?

My registration.php page sends a user to my login.php page with:

if(mysqli_stmt_execute($stmt)){
// Redirect to login 
header("location: login.php");
} else{
echo "<span style='color: red; margin-left: 5px;'>Something went wrong. Please try again later</span>";
            }

I'd like to figure out how to carry the username & email that they chose on the register.php page over into the input fields on the login.php page

Use this

header("location: login.php?username=".$your_username."&email=".$your_email);

You are able to send your username and email variable with your header function like this

header("location: login.php?username=$user &email=$email");

and on the login.php page you will get them like this:

$username=$_GET['username'];
$email = $_GET['email];

i hope this will help you out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM