dsg138
asked on
Filtering data with Checkboxes
Experts, I am interested in filtering the results of my dataset based on the user's selections.
I'd like to have check boxes that can be checked or unchecked and will allow my users to add or remove criteria to the search.
I found a site that functions exactly how I want mine to work:
http://www.ajmadison.com/b.php/Side-by-Side;Refrigerators/N~26
From the looks of the URL, it looks like the condition string is added to the URL.
I'm interested in doing something like this but I can't find any information about how to do this. I think it's php, but can't tell what else is needed. Is there AJAX involved?
Has anyone done something like this and would you have any examples of how to do this?
Thanks in advance,
-dsg
I'd like to have check boxes that can be checked or unchecked and will allow my users to add or remove criteria to the search.
I found a site that functions exactly how I want mine to work:
http://www.ajmadison.com/b.php/Side-by-Side;Refrigerators/N~26
From the looks of the URL, it looks like the condition string is added to the URL.
I'm interested in doing something like this but I can't find any information about how to do this. I think it's php, but can't tell what else is needed. Is there AJAX involved?
Has anyone done something like this and would you have any examples of how to do this?
Thanks in advance,
-dsg
I believe the example page is not using ajax. Just like Unspoken1 mentioned, put all the checkboxs in a form, and trigger a form submit if any checkbox is being checked/unchecked using onclick event. The form should be sending to the query function so it made the suitable query and return the result back to the page.
First, it's not ajax, second it's not a checkbox.
They are actually images
http://www.ajmadison.com/phpdocs/ajtest/images/endeca/miltsel_unchecked.gif
with a href locations that are links to process the button pressed
http://www.ajmadison.com/b.php/KitchenAid;Refrigerators/N~26+4294967287
They are actually images
http://www.ajmadison.com/phpdocs/ajtest/images/endeca/miltsel_unchecked.gif
with a href locations that are links to process the button pressed
http://www.ajmadison.com/b.php/KitchenAid;Refrigerators/N~26+4294967287
ASKER
Thanks for the feedback.
I've done HREF Locations before, but in this case, it looks like each of the criteria are either added to the string or removed from the string (if it's already added).
So you can have 5 different criteria all on one HREF location.
I'm not sure how to do that part.
Does anyone have any examples on how to do that?
I've done HREF Locations before, but in this case, it looks like each of the criteria are either added to the string or removed from the string (if it's already added).
So you can have 5 different criteria all on one HREF location.
I'm not sure how to do that part.
Does anyone have any examples on how to do that?
sure you can have a bunch of criteria, they did some off coding and made it look like part of the url. but in general it's done something like this
selection.php?brand=Kitche nAid&Price =500,1000& Color=Blac k,Stainles s
selection.php?brand=Kitche
ASKER
Thanks...
So in your example above:
selection.php?brand=Kitche nAid&Price =500,1000& Color=Blac k,Stainles s
Let's say I no longer want Price=500,1000 in my Criteria.
I would click the checkbox icon next to $500 - $1000.
How would I make the HREF dynamically remove that criteria at the same time keeping all the other criteria?
So in your example above:
selection.php?brand=Kitche
Let's say I no longer want Price=500,1000 in my Criteria.
I would click the checkbox icon next to $500 - $1000.
How would I make the HREF dynamically remove that criteria at the same time keeping all the other criteria?
No that link would just NOT have any price variable
selection.php?brand=Kitche nAid&Color =Black,Sta inless
selection.php?brand=Kitche
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I never noticed the whole page reload, I thought it was ajax, but you can go about it with a non ajax approach. I think the author wants us to write code for him.
ASKER
QuincyDude,
I did notice that the checkbox'a link changes after each refresh. And the links change based on the multiple criteria selected.
So really, it would have to remember the Criteria in some kind of String, perhaps $Criteria.
I would first have to check if that value was already added.
If it was, then the link would remove the new criteria, if not, it would add it.
Then each link would be something like $Criteria + (or -) $NewCriteria?
Then the new criteria would be passed to the link at every page refresh?
I want to make sure I understand the basic concept... is that it?
I did notice that the checkbox'a link changes after each refresh. And the links change based on the multiple criteria selected.
So really, it would have to remember the Criteria in some kind of String, perhaps $Criteria.
I would first have to check if that value was already added.
If it was, then the link would remove the new criteria, if not, it would add it.
Then each link would be something like $Criteria + (or -) $NewCriteria?
Then the new criteria would be passed to the link at every page refresh?
I want to make sure I understand the basic concept... is that it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This makes since. I think I understand the concept. Thanks for clarifying it for me.
Non ajax approach >>
Just send the checked to a php script via a form and have it search mysql via what has been checked.