Passing parameters with post to a new page


I’m trying to pass parameters from one page to the other.

I built an if statement in the statement I check if a session exists in case it exists I try to redirect the user to a different page.

I have on the new page a “div” that I would like to input a message once the user is redirected.

I am struggling with this code.

The code I have so far is:

 if( isset($_SESSION['name']) || isset($_COOKIE['email'])){

  $Nav_bar_message = 'Eli is king';

  header('location: Home_Page.php?Nav_bar_message');


Here is the code on the second page with the div:


<p><?= $Nav_bar_message ;?> </p>


Thank you for your help.


That will redirect, but it wont show any messages.

Are you using


at the top of those pages?


Thank you for your answer

I actually wanted to

Pas a variable using the url.

I found the following article that helps a lot:


If you want to pass a value via get request (in the url) then you have to have a variable to hold the value.


if(isset($_GET['v'])) {
    echo htmlentities($_GET['v']);
} else {
    echo "Nothing was passed";


Thank you,