header location delay
Do the redirect using client-side scripting:
<script>
window.setTimeout(function() {
window.location = 'page2.php';
}, 5000);
</script>
<p>Message has been sent.</p>
You cannot do this with a HTTP location redirect, as this redirect will happen as soon as the browser gets the header. Instead, use a refresh redirect in the header:
header( "Refresh:5; url=http://www.example.com/page2.php", true, 303);
This should work on modern browsers, however it is not standardized, so to get the equivalent functionality would be do use a meta refresh redirect (meaning you'd have to output a full HTML too):
<meta http-equiv="refresh" content="5;url=http://www.example.com/page2.php">
From the Wikipedia page:
Used in redirection, or when a new resource has been created. This refresh redirects after X seconds. This is a proprietary, non-standard header extension introduced by Netscape and supported by most web browsers.