Set it as a $_SESSION
value.
in page2:
$_SESSION['message'] = "Post successfully posted.";
in page1:
if(isset($_SESSION['message'])){
echo $_SESSION['message']; // display the message
unset($_SESSION['message']); // clear the value so that it doesn't display again
}
Make sure you have session_start()
at the top of both scripts.
EDIT: Missed )
in if(isset($_SESSION['message']){