Best Way to Filter?

Hi all, it’s something I’ve been needing to do for a while, and that is to filter results on the page such as my example below (although they use ASP.NET but you can get a feel of what I’m wanting to achieve). Quite like their way with check-boxes to filter.

Click here to view example.

They’re using javascript there, but you don’t want to entirely rely on that.

First, get it working without javascript, where the checkboxes have an [Update] submit button, and the page includes a separate PHP script to process the form fields and provide the appropriate content.

Once that fundamental base layer is working, you can use scripting to remove the [Update] submit button, and on a change of the checkbox you can request the content via AJAX instead.

Get the fundamentals working first though, otherwise you’ll be screwed when client-side scripting is not available.

Hi there, thanks for your message. Ok I see, so it’s probably best to head away from the Javascript approach? It’s a useful thing to be able to do, just not 100% sure on how to achieve this. Gerrr! :smiley:

Yes, only because you can always guarantee your PHP server being there, but you cannot guarantee that the client runs the JavaScript code.

There’s a good book called Bulletproof AJAX, which also provides the [url=“”]code and demo pages online, which takes you through these issues and how to successfully handle them.