I want to have a drop down search box.
I have the following but am stuck as to what to put for where I have the question marks!
<form action="???" >
<select name="catid" onChange="form.submit();" >
<option value="0">Search by Colour...</option>
<option value="????">Black Bags</option>
<option value="????">Red Bags</option>
</select>
</form>
In my .htaccess I have:
RewriteRule ^searchbags/(.*)/$ search.php?q=$1&rewrite=1%{QUERY_STRING} [L]
RewriteRule ^searchbags/(.*)/(.*).html$ search.php?q=$1&page=$2&rewrite=1%{QUERY_STRING} [L]
No, they are just mentioned in the title and/or description.
I will also want to do the same for brands, but as not all merchants enter the name in the brand field it would be a similar search on the title and description
---------
Jill
Hi Jill,
The action attribute has to point to an actual URL (search.php), and then additional code would be required at the top of search.php to redirect to the search engine friendly URL. So, keeping your form code pretty much as you have it, but with /search.php as the action (or /path/search.php if Price Tapestry is in a sub-directory), and the actual query you want for each option as the value attribute, i.e.:
<form action="/search.php" method="GET">
<select name="catid" onChange="form.submit();" >
<option value="">Search by Colour...</option>
<option value="Black Rags">Black Bags</option>
<option value="Red Rags">Red Bags</option>
</select>
</form>
Then, at the top of search.php (immediately after the require("includes/common.php")
line), add this code to redirect if $_GET["catid"] is set:
if ($_GET["catid"])
{
$url = "/searchbags/".tapestry_hyphenate($_GET["catid"])."/";
header("Location: ".$url);
exit();
}
For your brand drop-down, you could use exactly the same code, but in the value fields of the option tags, use the actual search code to search a brand, for example:
<option value="brand:Prada:">Prada</option>
Cheers,
David.
PERFECT! Thank you again - you're brilliant as usual :)
HEY - it's bank holiday - what are we doing working?!
---------
Jill
Hi Jill,
Are colours actually categories as far as your site / feeds are concerned?
Cheers,
David.