I have a search results page and on the page, I would like to be able to filter by category. So when the user searches an item, it gets passed to the results page in the url like:
What I would like to do is take the value of "s" and use it in a link to another page.
What I am thinking is doing something like this:
$_searchquery = $_GET['s'];
Then adding the $_searchquery variable to the url I am wanting to redirect to by doing something along these lines:
<a href="website.com/?s=<?php echo $_searchquery ?>&category_name=example">
Example Category </a>
Which in theory will redirect to a search results page that will display the search results for 'example' that appear in the 'example' category. Is this correct?