<form ... method="get">
<checkbox name="category[]" value="1">
<checkbox name="category[]" value="2">
<checkbox name="category[]" value="3">
...
I w开发者_运维问答ant the final get query to look like the following, if all items are checked: ?category=1,2,3
If only 1 and 3 are checked: ?category=1,3
What's the best way to achieve this?
You could use Javascript to manipulate a hidden field:
<input type="hidden" name="category" value="" />
When either checkbox is changed, update the value (i.e. "1,3" or "1,2,3") as needed.
精彩评论