I’m using Twitter’s bootstrap and need to pass a delimited list of checkbox selections to my server for processing. The checkbox HTML looks like this:
<div class="controls">
<label class="checkbox"><input type="checkbox" name="my_match[]" value="190">TEST 190</label>
<label class="checkbox"><input type="checkbox" name="my_match[]" value="200">TEST 200</label>
<label class="checkbox"><input type="checkbox" name="my_match[]" value="210">TEST 210</label>
</div>
...
$.post("form.php", $("#form_id").serialize(), function(){
...
});
I’m passing the form values as a serialized string using jquery but the values are being sent like so:
my_match=190&my_match=200
Is it possible to send them in the following format?
my_match=190:200
I’m not sure if I need to change my HTML or this is something I need to handle with javascript. Any thoughts?
Something like this would do the trick:
Try out the fiddle
Edit: This is basically exactly what Chase described in his answer.