Dynamic combo box

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

    • Jan 2011
    • 1

    Dynamic combo box

    Hi,
    I’m new to PHP, MySQL and JavaScript so perhaps my ambition has the upper hand over reality, but...
    I’m trying to learn how to make a dynamic dropdown box. The first box has the vehicle make and depending on the choice, the vehicle "models" of the chosen "make" will appear in the second dropdown box.
    I have created a MySQL table with 3 fields. 1 – sequential number, 2 – list of “vehicle makes” and 3 – list of vehicle models.
    I need help firstly making sure the data is correctly recorded in the database.
    Secondly, how to access the data, and
    Finally, the dropdowns.
    Is anyone willing to teach?
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: Dynamic combo box

    Well, this is not as simple as just describing it in words.

    Though not very difficult, it requires extensive knowledge of PHP, MySQL and Ajax.

    First, you need two tables, one for makes and one for models. You can also make it with one table but it probably becomes more complicated.

    Then, you need some Ajax script that whenever you select a make from the first dropdown, will retrieve the models for the selected make and will populate the second dropdown. The Ajax script is triggered by an "onchange" event associated to the first dropdown.

    Then, you need a piece of PHP code that will retrieve the Makes from the first table in the database and will populate the first dropdown.

    Last, another PHP script, that will be "called" by the Ajax script, to retrieve the models from the second table in the database, using as "where clause" the Make value passed by the Ajax.

    Now imagine all the above a second time, slightly modified to allow you to create a simple interface so that you can populate the two tables in the database...


    Furthermore, I believe that you want this in order to create some kind of search facility or Add posting facility, so this doesn't end here, you would need further coding....


    Teaching you, as you are saying, all these things, can require days and as you understand it is impossible for anyone to dedicate such an amount of time.

    You would rather need some ready to use code, but, all of the above, require quite some hours of an experienced programmer, to handcode in BV.

    Pls note that there are some PHP / MySQL code generators that you can learn how to use in a rather short time, and will allow you to do what you want. However, it is very hard (without HTML, CSS, and template engines knowledge) to customize them to suit a BV site.

    You can, however, use an Iframe to display an application created this way, inside a BV page.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    • Rob (SA)
      Lieutenant Colonel

      • Nov 2006
      • 586

      #3
      Re: Dynamic combo box

      Hi Renoir,

      Navaldesign is the best person here to give advise but in the interim try have a look at this link

      The person who wrote this script actually previously had one with the various makes of motor vehicles.

      I hope this helps
      Kind Regards
      Rob
      www.gnjgf.co.za
      www.oryan-projects.com

      Comment

      Working...
      X