This form is in the navbar/header of every page of the website. The search term is submitted to the ‘search’ action in the ‘ProductsController’: all works fine.
But the URL where the users are redirected to is (no surprise): https://mysite.com/products/search
(with a page with the correct results)
So: The user types something (like ‘ipad’) in that searchform (anywhere on the site). And on submit, he/she is immideatly sent/redirected to https://mysite.com/products/search/ipad
The reason I would like this, is because I want users to be able to copy a link and send that to a friend. And whan the friend opens that link, they are directly on the page with the search resluts.
To be clear: I have no issues with this last part (I have allready made a method that ‘takes’ that param from the URL and displays the correct page).
My only question/issue is: How to put that param directly in the URL on submit form.
Hi Raul,
Thanks! I have seen that plugin and that would probably work. But… I would like to know how to achieve this without this plugin. Because I probably want to use this ‘trick’ (put a submitted formfield in the URL) in some other controllers (not only on search functions, but also others).
And I simply want to learn & understand how ths works.
From your answer, I understand that it IS possible? thats allready something. Am I correct is asuming that PRG is the term that is used for this technique? Because if so, I will hopefully find some pointers when searching on discource.cakephp or Google
Shouldn’t this be possible by simply changing the form-type to GET instead of the default POST?
Secret data of course should never be submitted using GET!