Send post values with header location

Use a PHP session. On the redirect page, start the session and assign the $_POST data to the $_SESSION:

<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$errors = array();
	
if (empty($_POST['name'])) {
		$errors['name'] = 'Please enter your name.';
	} else {
		$name = filter_var($_POST['name'], FILTER_SANITIZE_STRING);
	}
	
	
	if (empty($_POST['employer'])) {
		$errors['employer'] = 'Please add your employer.';
	} else {
		$employer = filter_var($_POST['employer'], FILTER_SANITIZE_STRING);
	}

        session_start();
        $_SESSION = $_POST;
        session_write_close();
	
	if ($name && $employer ) { //	
header("location: page3.php ");
exit ();	
}

}
<form name="myform" action="" method="post">

<p>Name</p>
<input type="text" name="name" value="" />
<span class="warning"><?php if (isset($errors['name'])) echo $errors['name']; ?> </span>

<p>Employer</p>
<input type="text" name="employer" value="" />
<span class="warning"><?php if (isset($errors['employer'])) echo $errors['employer']; ?> </span>

<input name="somename" type="hidden" value="somevalue"/>
<input type="submit" value="send">
</form>

Then on page3.php, restart the session and set the $_SESSION data to the $_POST. Then use as normal:


<?php
session_start();
$_POST = $_SESSION;
?>