You are not logged in.
Pages: 1
I'm having a little trouble creating a custom form field type which will be a list of checkboxes that a user can select and then all the selected values are stored as a single comma delimited string. I'm drawing it the same way the list form field is drawn, except that I removed the select and option tags and replaced them with a checkbox input. This correctly draws what I want. The problem I'm having is that on the process, only the last checked value is being stored. I can't figure out why this is since all of the checkbox inputs have the same name and when I check a box the input does have the checked="checked" added to it. I have printed the $_POST variable right after I hit the submit button but it also only shows the last checked value. Is there a way to get all the checked values to appear similar to how a regular checkbox would behave?
Thanks
Offline
When you're drawing the <input> elements make sure you set the name attribute with [] at the end. I.e.
<input type="checkbox" name="<?=$field["key"]?>[]" value="checkbox_value" />
Offline
That worked perfect!
Thank you!
Offline
Pages: 1