0
Good morning, I would like to share the data entered in an input between 2 files. In the Form action I use the validation file, to check the login and password, but I wanted the data typed in these fields also to be for another file, so I show the name of the user, according to his login, for that I would need to pass the variable $login to the second file:
$login = $_POST['login'];
in the two files, in 1° for verification and in 2° for consultation in DB. Thank you already.
Session - http://php.net/manual/en/intro.session.php or Cookies - http://php.net/manual/en/features.cookies.php
– Pedro Augusto
in the form action file I put $_SESSION['login'] = $login; e $_SESSION['Cpf'] = $Cpf; and I made q this file that receives these variables per post redirect the browser to the 2° file in I need these variables too, and to test I gave an echo $_SESSION['login']; but this returns the error "Undefined variable: _SESSION "
– João
I also tried $_SESSION[$Cpf] = $_POST['Cpf']; and echo $_SESSION[$Cpf];
– João
Using Cookies it was possible to solve the problem as follows: 1° File: setcookie("Cpf", $Cpf); setcookie("login", $login); // 2° file: $Cpf = $_COOKIE["Cpf"]; $login = $_COOKIE["login"]; .
– João