PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

multiple categories

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • multiple categories

    Hello,
    Can antone help !
    I was trying to use the search to filer through multiple categories but dont seem able to do so.
    Is this possible
    If i have one category set for "search all" it renders all categories to search all
    I have included some code

    <form method="get" action="search.php">

    <input type="text" name="zoom_query" size="20">
    <input type="submit" value="Search">
    </form>
    <form method="get" action="search.php">
    <table cellspacing="3" cellpadding="0" width="100%" border="0">
    <tbody>
    <tr>
    <td>Type of Accommodation<br />
    <select name='zoom_cat[]'>
    <option value="-1" selected="selected">All</option>
    <option value="2">Bed &amp; Breakfasts</option>
    <option value="1">Self Catering</option>
    <option value="0">Hotel</option>
    <option value="3">Caravan Sites</option>
    </select> </td>
    </tr>
    <tr>
    <td>Town<br />
    <select name="zoom_query" onchange="MM_validateForm('zoom_query','','R');ret urn document.MM_returnValue">
    <option value="Kirkolm">Kirkolm</option>
    <option value="Portlogan">Portlogan</option>
    <option value="portpatrick">Portpatrick</option>
    <option value="Sandhead">Sandhead</option>
    <option value="stranraer">Stranraer</option>
    <option value="drummore">Drummore</option>
    </select></td>
    </tr>
    <tr>
    <td></td>
    </tr>
    <tr>
    <td>Pets Allowed<br />
    <select name='zoom_cat[]'>
    <option value="-1">All</option>
    <option value="4" selected="selected">Yes</option>
    <option value="5">No</option>
    </select></td>
    </tr>
    <tr>
    <td><br />
    <input type="submit" value="Search" /></td></tr>
    </tbody>
    </table>
    </form></td></tr>

    Many thanks in advance

    jonny

  • #2
    Categories work on a boolean OR comparison, that is, with Multiple Categories enabled, you would still be selecting results which match category A or category B, rather than category A and category B, which is what you are implying in the code above.

    You are also expecting a sub-category type of feature, or multiple sets of categories, where you can specify an "All" for category group A ("Type of Accomodation") and a different "All" for category group B ("Pets allowed"). This isn't going to work unless you use custom Javascripting to manually process the "All" option and replace them with values (eg. when Pets allowed "All" is selected, you would provide a zoom_cat[] array with values 4 and 5).

    But the first problem still stands. In short, your search criteria is better suited to a database solution and a custom search function which performs database queries based on your database schema.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment

    Working...
    X