I need to add a "search by category" and "search by location" menu on the left of my list page similar to the cars template on my adventures table's list page.
I've added a {$row00Advent_Search_value} in the page and copied the event in "listonload " from the cars list page listonload to the adventures table's list events listonload and made all the field and table changes (I think?).
When I upload the files, I get the following error: Undefined variable: Category
Here is the code:
global $strSQL,$conn, $smarty;
//search by brand
$message="<b>Search by Category<br>";
$str = "select count(Category) as numbers, Category from adventures group by Category";
$rs = db_query($str,$conn);
while ($data = db_fetch_array($rs))
{
$make = str_replace(" ","+",$data["Category"]);
$message = $message ."<a href=\"adventures_list.php?a=search&value=1&SearchFor=".$Category."&SearchOption=Contains&SearchField=Category\">".$data["Category"]." (".$data["numbers"].")</a>";
$message = $message ."<br>";
}
//show all
$message = $message ."<br><a href=\"adventures_list.php?a=showall&value=1&SearchFor=&SearchOption=&SearchField=\">Show All</a><br><br>";
//search by category
$message = $message ."Search by Location<br>";
$str2 = "select count(Location) as numbers, Location from adv ntures where Location!='' and Location is not NULL group by Location";
$rs2 = db_query($str2,$conn);
while ($data2 = db_fetch_array($rs2))
{
$Location = str_replace(" ","+",$data2["Location"]);
$message = $message ."<a href=\"adventures_list.php?a=search&value=1&SearchFor=".$Location."&SearchOption=Contains&SearchField=Location\">".$data2["Location"]." (".$data2["numbers"].")</a>";
$message = $message ."<br>";
}
$smarty->assign("row00Advent_Search_value",$message);
What am I doing wrong?
Wishlist! - It would be great to somehow have a feature where this can be a standard event or feature to put in menus like this in a project..
Thanks for your help.