If you really stand behind your bad idea, just go for:
if(isset($_POST['submit'])) {
echo "<div>My hidden content</div>"
}
This will be on secondary page ^
<form action="page2.php" method="post">
<button name="submit">Submit</button>
</form>
This will be on your index page ^
As guys mentioned before, it's better practice to use JavaScript to do that. Call a post request without refreshing the page. Or if you want open connection between client and server, use node.js (server-side JavaScript)
Well, if you want to stay on the first page after click on the button and you won't use any JavaScript, you can do it also this way. But it will get redirected 2 times, so it's kinda... Not efficient and client friendly.
Your second page:
if(isset($_POST['submit'])) {
setcookie("CLICKED",'ThisValueDoesntMatter',time()+31556926 ,'/');
header("HTTP/1.1 301 Moved Permanently");
header('Location: ' . $_SERVER['HTTP_REFERER']);
}
if(isset($_COOKIE['CLICKED'])) {
echo "<div>My hidden content</div>"
}
It is also insecure if the button is supposed to be on some page with authentication.
The index page stays the same.
NOTE: The cookie has lifetime of 1 year.