Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
how can I pass the value of $_POST['login'] to variable $login, to use the value in the page home.php ? using this code:
$_POST['login']
$login
home.php
header('location:home.php');
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']; ?>
Add a comment
Use $_SESSION array.
$_SESSION
if (!isset($_SESSION)) session_start(); $_SESSION['login'] = $_POST['login'];
After switching to the next page you can call SESSION variable with 'login' key using:
SESSION
'login'
if (!isset($_SESSION)) session_start(); echo $_SESSION['login'];
Required, but never shown
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.
Explore related questions
See similar questions with these tags.