Jump to content

AJAX SEARCHES


amwd07

Recommended Posts

I have a few check box options for searches below is the search code and functions

I need a little help here with the code everything works fine but when you select more then one option it combines the searches I need to use OR instead of AND so when the user selects ie. Traditional & European it comes up with anything containing both or one of these and not just the matches with both of them

 

example of how searches currently operate

http://www.dinewithus.co.uk/new/dining2.php?county_url=worcestershire&twn_url=worcester

 

search code ...

<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF">
              <tr>
                <td width="20" bgcolor="#F9F9F9"><p class="style1">
                    <input name="traditional" type="checkbox" id="traditional" onclick="ToggleFilter(this.checked, traditional);" value="" />
                </p></td>
                <td width="108" bgcolor="#FFF7AA"><strong><span class="style54"><span class="style58"><strong>Traditional</strong></span></span></strong></td>
                <td width="20" bgcolor="#F9F9F9"><input name="european" type="checkbox" id="european" onclick="ToggleFilter(this.checked, european);" value="" /></td>
                <td width="108" bgcolor="#FFFFCC"><span class="style55"><span class="style1">European</span></span></td>
                <td width="20" bgcolor="#F9F9F9"><input name="finedining" type="checkbox" id="finedining" onclick="ToggleFilter(this.checked, finedining);" value="" /></td>
                <td width="108" bgcolor="#FFF7AA"><span class="style55"><strong><span class="style54"><strong><span class="style58">Fine Dining</span></strong></span></strong></span></td>
                <td width="20" bgcolor="#F9F9F9"><input name="fish" type="checkbox" id="fish" onclick="ToggleFilter(this.checked, fish);" value="" /></td>
                <td width="108" bgcolor="#FFFFCC"><strong><span class="style54"><span class="style58"><strong><strong>Fish</strong></strong></span></span></strong></td>
                <td width="20" bgcolor="#F9F9F9"><input name="cafe" type="checkbox" id="cafe" onclick="ToggleFilter(this.checked, cafe);" value="" /></td>
                <td width="108" bgcolor="#FFF7AA"><strong><span class="style54"><span class="style58">Cafe Culture</span></span></strong></td>
                <td width="20" bgcolor="#F9F9F9"><input name="african" type="checkbox" id="african" onclick="ToggleFilter(this.checked, african);" value="" /></td>
                <td width="114" bgcolor="#FFFFCC"><span class="style58">African</span></td>
              </tr>
              <tr>
                <td bgcolor="#F9F9F9"><input name="modern" type="checkbox" id="modern" onclick="ToggleFilter(this.checked, modern);" value="" /></td>
                <td bgcolor="#FFF7AA"><span class="style1"><strong>Modern British</strong></span></td>
                <td bgcolor="#F9F9F9"><input name="asian" type="checkbox" id="asian" onclick="ToggleFilter(this.checked, asian);" value="" /></td>
                <td bgcolor="#FFFFCC"><span class="style58">Asian</span></td>
                <td bgcolor="#F9F9F9"><input name="pubbar" type="checkbox" id="pubbar" onclick="ToggleFilter(this.checked, pubbar);" value="" /></td>
                <td bgcolor="#FFF7AA"><span class="style58">Pub/Bar</span></td>
                <td bgcolor="#F9F9F9"><input name="veg" type="checkbox" id="veg" onclick="ToggleFilter(this.checked, veg);" value="" /></td>
                <td bgcolor="#FFFFCC"><span class="style58">Veg</span></td>
                <td bgcolor="#F9F9F9"><input name="speciality" type="checkbox" id="speciality" onclick="ToggleFilter(this.checked, speciality);" value="" /></td>
                <td bgcolor="#FFF7AA"><strong><span class="style54"><span class="style58">Speciality</span></span></strong></td>
                <td bgcolor="#F9F9F9"><input name="carvery" type="checkbox" id="carvery" onclick="ToggleFilter(this.checked, carvery);" value="" /></td>
                <td bgcolor="#FFFFCC"><span class="style1"><strong>carvery</strong></span></td>
              </tr>
            </table>

 

Function below

function wifi(ds, row, index){return (row.wifi && row.wifi == "1") ? row : null;}
function smoking_al_fresco(ds, row, index){return (row.smoking_al_fresco && row.smoking_al_fresco == "1") ? row : null;}
function award_recognitions(ds, row, index){return (row.award_recognitions && row.award_recognitions == "1") ? row : null;}
function disabled_access_facilities(ds, row, index){return (row.disabled_access_facilities && row.disabled_access_facilities == "1") ? row : null;}
function garden(ds, row, index){return (row.garden && row.garden == "1") ? row : null;}
function real_ales(ds, row, index){return (row.real_ales && row.real_ales == "1") ? row : null;}
function function_room(ds, row, index){return (row.function_room && row.function_room == "1") ? row : null;}
function open_fires(ds, row, index){return (row.open_fires && row.open_fires == "1") ? row : null;}
function speciality_diet_friendly(ds, row, index){return (row.speciality_diet_friendly && row.speciality_diet_friendly == "1") ? row : null;}
function with_accommodation(ds, row, index){return (row.with_accommodation && row.with_accommodation == "1") ? row : null;}
function private_dining(ds, row, index){return (row.private_dining && row.private_dining == "1") ? row : null;}
function traditional(ds, row, index){return (row.traditional && row.traditional == "1") ? row : null;}
function european(ds, row, index){return (row.european && row.european == "1") ? row : null;}
function finedining(ds, row, index){return (row.finedining && row.finedining == "1") ? row : null;}
function fish(ds, row, index){return (row.fish && row.fish == "1") ? row : null;}
function cafe(ds, row, index){return (row.cafe && row.cafe == "1") ? row : null;}
function african(ds, row, index){return (row.african && row.african == "1") ? row : null;}
function modern(ds, row, index){return (row.modern && row.modern == "1") ? row : null;}
function asian(ds, row, index){return (row.asian && row.asian == "1") ? row : null;}
function pubbar(ds, row, index){return (row.pubbar && row.pubbar == "1") ? row : null;}
function veg(ds, row, index){return (row.veg && row.veg == "1") ? row : null;}
function speciality(ds, row, index){return (row.speciality && row.speciality == "1") ? row : null;}
function carvery(ds, row, index){return (row.carvery && row.carvery == "1") ? row : null;}

Link to comment
https://forums.phpfreaks.com/topic/66320-ajax-searches/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.