好的网址传递变量

What's the best approach to pass variables from one page to another if I don't want to alter a nice link? I'm using Zend Framework routers in php.

Lets say I have a list page with

<a href='/nice-link1/'>link1</a>
<a href='/nice-link2/'>link2</a>
<a href='/nice-link3/'>link3</a>

But I need to pass a status parameter e.g.(?previous_search=dog). I dont't want to expose to crawlers and users an url which is different than this:

<a href='/nice-link1/'>link1</a>

as users may share the link. But at the same time i need the previous_search variable in the /nice-link1/ page. I'd like to avoid session variables too. I was thinking to jquery but I'm not sure.

Thanks!

Personally I'd use Zend_Session_Namespace to store variables and keep them away from the URL.

http://framework.zend.com/manual/1.12/en/zend.session.html

  1. Save your data as a cookie. http://www.quirksmode.org/js/cookies.html

  2. Save your data via local storage. http://diveintohtml5.info/storage.html

  3. Have your link actually be a form submit using POST so that variables aren't surfaced to the URL string. http://www.w3.org/TR/html401/interact/forms.html#h-17.13.1

In your instance, I'd recommend the cookie route. It's perfect for saving the user-specific data you'd like to respond to on your page, like previous searches.