I’m integrating an existing search script (which works correctly) into Modx as a snippet but the script is having problems getting past retrieving the search url variable.
My test page is in the directory test/search.
Modx has friendly urls turned on.
The page has a simple search form at the top of the page:
<form name="form" action="[~[*id*]~]" method="get">
<input type="text" name="q" />
<input type="submit" value="Search" />
</form>
...followed by the search snippet:
$var = isset($_GET['q']) ? mysql_real_escape_string($_GET['q']) : '';
$search = trim($var); //trim whitespace
echo $search;
deleted remaining code
On first loading the page,
http://www.site.com/test/search, $search value displays as "test/search" instead of nothing.
When I enter a search term and submit a 404 page appears instead of displaying the search term, eg url:
http://www.site.com/test/search?q=sydney
Stumped. No doubt it’s probably something simple I’ve overlooked!