473,672 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AutoSuggest Results Filtered via Drop Down

2 New Member
http://www.etcontrol.c om/autosuggest/autosuggest.php

I am trying to add a drop down to filter the results. Is there a way to do that? Or just point me in the right direction. Thanks!!!

Expand|Select|Wrap|Line Numbers
  1. <?php include('xxxx.php');   
  2.  
  3.     $SQL_FROM = 'directory';        
  4.     $searcht = $_GET['t'];
  5.     $SQL_WHERE = 'City';
  6.  
  7.     if ($searcht=='Zip')
  8.     $SQL_WHERE = 'Zip';
  9.  
  10.     if ($searcht=='Manuf')
  11.     $SQL_WHERE = 'Manuf';
  12.  
  13. ?>
  14. <?php
  15.             $searchq        =    strip_tags($_GET['q']);        
  16.             $getRecord_sql    =     'SELECT * FROM '.$SQL_FROM.' WHERE '.$SQL_WHERE.' LIKE "'.$searchq.'%"';
  17.             $getRecord        =      mysql_query($getRecord_sql);
  18.             if(strlen($searchq)>0){
  19.  
  20.             echo '<ul>';
  21.             while ($row = mysql_fetch_array($getRecord)) {?>
  22.  
  23.     <img src="/images/icon.png" border="0" />
  24.     <?php echo $row['City'];?> 
  25.     <?php echo $row['Zip'];?> <img src="/autosuggest/lib/white_arrow.png" width="12" height="12" /> 
  26.     <?php echo $row['CoName'];?> <img src="/autosuggest/lib/phone.png" width="12" height="12" />
  27.     <?php echo $row['Phone'];?> 
  28.     <?php echo $row['DLR']? '<img src="dealer.gif" align="middle">' : '';?>
  29.     <?php echo $row['RNT']? '<img src="rental.gif" align="middle">' : '';?>
  30.     <?php echo $row['MFG']? '<img src="manuf.gif" align="middle">' : '';?>
  31.     <?php echo $row['SVC']? '<img src="service.gif" align="middle">' : '';?>
  32.     <?php echo $row['SUP']? '<img src="supplier.gif" align="middle">' : '';?>
  33.     <?php echo $row['PK']? '<img src="park.gif" align="middle">' : '';?>
  34.     <?php echo $row['NDR']? '<img src="national.gif" align="middle">' : '';?><br /></a><?php } echo '</ul>';
  35.         ?>
  36. <?php } ?>
This code is from Woork Blogspot
Jul 8 '08 #1
3 2206
acoder
16,027 Recognized Expert Moderator MVP
Where would you want the drop down? What options would you have in the drop down?
Jul 9 '08 #2
mfdesigns
2 New Member
Thanks for the response! Researching online for a solution I come to a conclusion to use a onChange function (JS) within the option value that will be called. My hang up is how to start it. Basically, the AutoSuggest filters Cities from the database based onKeypress function and shows results ... what I am trying to do is filter the results only to show RV Service, RV Parks, and etc. ... each CITY line item in the database have option values 'SVC' for RV Service, or 'PK' for RV Parks. So when AUSTIN is typed in ... it will show every type of service in that City, but I would like to have a drop down to filter just RV Service for that CITY? Sorry I'm not a programmer so I trying to explain it the best I can. Any help is appreciated! As far as, the location of the additional code ... I really don't know. I assume it would be placed with the form entry (autosuggest.ph p), or the PHP page (search.php) that initiates the MySQL searches (the code I cut/pasted in my last post).

Thanks!

www.etcontrol.c om/search_page.php
Jul 13 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
Use checkboxes for the services. If the checkbox for a particular service is checked, display that entry.
Jul 14 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3225
by: Seth | last post by:
How can I hide an entire row of a table if one of the cells in that row is equal to a value drop down box value. My goal is to have a filtered table so that each cell in each row determines if it should be hidden by drop down boxes. Thanks for your help.
0
2069
by: Mike O. | last post by:
MS Access 2003 "filter by form" has drop down lists that allow the user to select values for each field to filter by. However, once some values are selected,the remaining dropdown lists remain the same and aren't progressively filtered to reflect the selections already made in other fields. This can be very tedious when filtering a large datasheet. Unlike Access, the MS Excel autofilter has automatic progressive filtering of value...
21
2242
by: JHNielson | last post by:
I have a table that I would like to be able for the users to search/filter. I have multiple fields to search: I built a form, and I would like them to be able to choose form a set of drop-downs which criteria to filter on. and then it show in the sub-form the records that match that criteria. I initially created a select query on the table I'm searching. With Dlookups of the drop-down values for each of the relevant fields.
1
5943
by: abTech | last post by:
Have struggled a lot to get a filtered drop down in the normal html and that too editable ... i have used table like auto-completion etc ... This is the simplest solution for a filtered drop down <SELECT NAME="drop" id='drop' onkeyup="editOption(arguments, this)" style='width:100px;cursor:text' mode="1"> <option value="0">Default</option> … </SELECT> Mode 0: Filters the list till a valid match is found, if not found then will behave...
1
1626
by: russot00 | last post by:
I have 3 drop down menus that are used in a search to locate restaurants in a db. All of the drop down menus function, a search can be submitted with any combination of drop downs and the results are sorted by restaurant name. The problem occurs when you do not select anything from a drop down ("All" is submitted for all drop downs) and submit the search, the following error occurs: "Can't connect because You have an error in your SQL syntax;...
14
2338
kcdoell
by: kcdoell | last post by:
Hello: I have a form (Default view =single form) with a subform (Default view =continuous forms) embedded into it. In the form I have three controls that display the Division, Working Region & Credit Region. The subform displays the data/records. The record source for both my form and subform is driven by a query, which is the way I filter the records that the end user will see via another form I created. Everything is working fine but...
1
2343
by: raamay | last post by:
I am not sure but i am looking for some help regarding values to be autosuggested from database when a user types in a textbox and the values should be a drop down list. I am using VB Net and it is something like the Autocomplete feature except that the values should be from database. I have not seen any links to this type of material but i just wanna know if it is possible. Infact i have found this type of stuff working with a combobox but...
0
8486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8931
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8608
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7446
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6238
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.