0

how can I pass the value of $_POST['login'] to variable $login, to use the value in the page home.php ? using this code:

header('location:home.php');
0

2 Answers 2

3

By using session-variables, like this:

<?php
session_start();
$_SESSION['login'] = $_POST['login'];
header('location:home.php');
?>

And

<?php
// Home.php
session_start();
$login = $_SESSION['login'];
?>
Sign up to request clarification or add additional context in comments.

Comments

0

Use $_SESSION array.

if (!isset($_SESSION)) session_start();

$_SESSION['login'] = $_POST['login'];

After switching to the next page you can call SESSION variable with 'login' key using:

if (!isset($_SESSION)) session_start();

echo $_SESSION['login']; 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.