PHP – JQuery – MySQL – Make a simple drop down menu

After the simple ToDo list here, I have decided to add more features to it. So, a possible feature, looks like this – you have a drop down menu with all the users in the database:

Then, after a selection, you get a list of their todo tasks:


That is the whole story. 🙂 So how it is built? Once the file “form_ajax.php” is loaded, we connect to the mySQL database, where we take the values for the optional button through php code. Once the optional button is changed, a JQuery function “change” is loaded, which does the following:

  1. Tries to get the value of the file data.php.
  2. In order to get it, in the data.php, we make a query to the db, with the id of the selected option.
  3. At the end JQuery displays what we have.

And that is how the long story looks short. The code comes here:

Enjoy it in GitHub as well! 🙂

Tagged with: , ,