Jump to content

Help - PHP/MySQL - Populate Drop-Down based on Dynamic Drop-down

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
ProServ

ProServ

    Newbie

  • Members
  • PipPip
  • 11 posts
Hi everyone,

I've tried various solutions with no avail.

Does anyone know a good resource for finding information on how to code a drop-down box (populated with MySQL data) and take the user's input (selection change) in order to populate another MySQL-data driven Drop-Down box?

If the page has to reload, no biggie. But, I'd prefer that it not.


Any ideas?

#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
in that case.. i think you should use ajax (if you don't want page loading) and btw you have pretty nice site ;)

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
1) You will need to use PHP to connect to MySQL - http://forum.codecal...-php-mysql.html

2) Set your SQL and retrieve your list, populate the values into drop down:

 <select name="name">
        <option value="<?php echo $result1; ?>"><?php echo $result1; ?></option>
</select>

3) To have the page not reload you will need to use JavaScript and PHP (AJAX). Set an onClick or onChange event for the select above. When that events fires call another PHP application that retrieves and returns the second lists values.

#4
Guest_Jaan_*

Guest_Jaan_*
  • Guests
PHP dynamic population of drop down list based on selection of one list

here's something for you i guess.. i think it helps