Jump to content

Ajax Checkbox Filter


Recommended Posts

I'm relatively new to Ajax and Javascript. However, I have a good background of PHP.


I came across this website:




As you can see, when I click on the check-box, it filters out the result. How can I do it?


I have been looking for check-box filtering, but, I couldn't find tutorial that quite like it. I might have missed it somewhere.


Please advice me. Thanks:)

Link to comment
Share on other sites

I was looking for a tutorial, but i can't find one, sadly, so i guess i will just try to walk you through it.... 


how i would make the example you provided is first create a mysql database filled with the info (that is what the baby carers is a large database of carers in Canada)


after that create a php file that displays all the information however you want it to be displayed.....  when first creating this just "SELECT * FROM Table" this will display the whole database for you ( you can add the queries in later). 


after you have that file you can begin the creating the front end....


basically there will be a couple parts to this


- javascript/ajax script connecting you to the .php file

- javascript code that checks the checkboxes if they are checked, and then creates a variable to be passed onto the .php file

- html code displaying the checkbox options

- <div> container where the .php results will be shown..

- and finally javascript/ajax code displaying the results from the .php in the <div> container....


it can be a bit complicated to try to explain.... so what you should dofirst... is create a database with info in it, and a .php file that displays all that info in a table (or list),and an .html file with your query options (checkboxes) and a container looking like this <div id="results"></div>


after that let me know where i can find it online and i will walk you through connecting it all together...

Link to comment
Share on other sites

  • 10 months later...

Hey sorry to dig this back up but this is EXACTLY what I am looking to do and I am in need of some help. I am new to all of this coding but I am learning. I learn by example and that seems to be an issue for some of this.


I am looking to add a list of different things on my site exactly like the baby stroller site. I want a list of all of the items then as a user checks the filter on the left side it updates the display to show just what the user is looking for. I also will be using MySQL for the data base but I have no idea where to start on the table displaying all the items and filtering them out with check boxes.


Again I learn from example so any form of Code to show me how I can do this would be AWESOME!

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.