How to create Combo Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dinesh1440
    New Member
    • May 2010
    • 16

    How to create Combo Box

    I want to create Combo Box like in Google for my project using PHP and MySQL.
    The term "combo box" is sometimes, incorrectly, used to mean "drop-down list". It is a combination of a drop-down list or list box and a single-line text box, allowing the user to either type a value directly into the control or choose from the list of existing options.
    If I have table as follows,in the web page that I am going to create if I type 'au' in the combo box Australia should appear.I may or may not select it. For example,there I can type Austria without selecting Australia.

    Id place
    1 America
    2 Australia
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    What you're looking for is Autocomplete or Autosuggest.

    There are many scripts and tutorials in Google to help you start this off.

    If you want to do this yourself, you need to know PHP and AJAX, then you can do it in 3 easy steps:


    1. On the text boxes onchange() method call a javascript that takes the current value and asynchronously (ajax) calls a PHP page with this value.

    2. PHP page finds the values in the DB and returns them.

    3. Javascript parses results returned and displays them in a floating div under the text box.

    Cheers,


    Dan

    Comment

    • dinesh1440
      New Member
      • May 2010
      • 16

      #3
      sir,
      Could you give me a sample code.And I do not know
      AJAX. So could i make it possible only using php and javascript.

      Comment

      Working...