header('location : page')
will end the current script and redirect and start another script
just like exit() or die() will cause
all variables will lose values and stop to be, exist
There is however one way to pass variables.
Using $SESSION array to store values.
And at next page you can turn on
[man]session_start/man
and read from $SESSION array.
$_SESSION values will exist until visitor closes down his browser.
Which is the end of his 'session' at your site.
Actually such SESSION values are stored in one small temporary file.
<?php
session_start(); // activate use of $_SESSION
$name = trim($_POST['name']);
$pass = trim($_POST['pass']);
$pass1 = trim($_POST['pass1']);
$email = trim($_POST['email']);
$exp = trim($_POST['client']);
$code = trim($_POST['code']);
if($error == false)
{
$_SESSION['name'] = $name;
$_SESSION['pass'] = $pass;
$_SESSION['email'] = $email;
$_SESSION['exp'] = $exp;
write($name, $pass, $email, $exp);
header('location:congrats.php');
}
?>
And in congrats.php
<?php
session_start(); // turn on and activate use of SESSION
// get those values
$name = $_SESSION['name'];
$pass = $_SESSION['pass'];
$email = $_SESSION['email'];
$exp = $_SESSION['exp'];
echo 'Congrats '.$name;
?>