Search code examples
phpif-statementstatements

Displaying hidden text using PHP


I am trying to come up with a php if statement for my site. I have a page called "research". There is text on this page with a link which says "contact me" This link links through to my contact page. Now, I need an if statement to say that if you are on the research page and you click on the contact me link, I need some text on the contact me page to be hidden and only be visible when you are on the contact page.

Is this possible?


Solution

  • On your contact page, you can get what you are looking for from: $_SERVER['HTTP_REFERER']. It will tell you which page the user came from getting to the contact page.

    However, you should not rely on this. Consult the following Q&A here on Stack Overflow: