1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating a search of two categories

Discussion in 'Templates, HTML, CSS, and Design Help' started by jason1971, Sep 2, 2015.

  1. jason1971 Customer

    Hi all,

    I am just wandering whether there is any way round being able to search two categories at once ?

    I have a search form in which I am trying to search category id 69 and 66 together, but it does not work. I just need to know whether.. A - It is possible ? and B - If so, how would I implement it?

    This is what I have so far that does not work with both type=69&type66 obviously it works fine with just one or the other, but I could do with it searching both really if poss..

    holiday-homes-in-wales.php?searchtext=&type=69&type66&Submit=Search

    Cheers Jason
  2. Mike-N-Tosh Owner

    Well, of course ANYTHING is possible! :p

    First I assume the url that you're showing is missing the "/searchresults.php" part before the "?", right?
    holiday-homes-in-wales.php/searchresults.php?searchtext=&type=69&type66&Submit=Search

    It sounds to me like the issue is in your form. If you want to have more than one value for a given variable (in this case the variable is 'type'), then you need to have a form element that accepts more than one variable such as a checkbox.

    You may find this php manual page helpful too:
    http://php.net/manual/en/faq.html.php
  3. jason1971 Customer

    Hi Mike,

    Thanks for the reply.

    Your first assumption is correct - my mistake :D

    Sorry I am not clear in what you mean with this...
    then you need to have a form element that accepts more than one variable such as a checkbox.
  4. Mike-N-Tosh Owner

    Form elements are the html elements within the form.
    <form name='myform' ... >
    <!-- these are you form elements -->
    <input type="text" name="search text" />
    ...
    </form>

    You said in the original post that you have "search form"? How is the user entering the categories into the form? Look at your form and then again refer to my previous post, especially the php.net reference.

Share This Page