简体   繁体   中英

Best way to display a message for users that came from a specific page on the website?

I have a quick question on the best way to show a particular message to users that navigated to a page via a particular link on the site.

The situation is I have a sidebar on the website and two of the links will point to the same page - one of them used to point to a page containing a form but now I want to change it to point to the same page as another link and display a message for users that clicked this particular link.

I tried changing the htaccess file and using HTTP_REFERER but because theses links are in a sidebar on every page that doesn't work - never thought that one through at the time!

Now I have tried simply changing the link and adding a parameter on the end, eg /page.html?question=yes and then doing the following on the page:

if ($_GET['question'] == 'yes')
{
    echo '..................';  
}

But that doesn't seem to be working either so I was wondering if anyone had came accross a similar problem and how they went about solving it?

Using $_GET and Querystring is the best match for you, but I'm not sure your file extension is being processed properly. Try to change .html to .php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM