Reputation: 61
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');
Upvotes: 0
Views: 1126
Reputation: 9918
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'];
Upvotes: 0
Reputation: 14863
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'];
?>
Upvotes: 3