It worked! Thanks!

On Jun 30, 5:49 pm, James <james.gp....@gmail.com> wrote:
> When you set your checkbox names, use the [] at the end of the name.
> For example:
>
> <input type="checkbox" name="myField[]" value="1" />
> <input type="checkbox" name="myField[]" value="2" />
>
> PHP will automatically convert that into an array.
> When you define your validation rules and messages, make sure to put
> myField[] in quotes, like 'myField[]'
>
> On Jun 30, 10:49 am, pimousse <delphine.ma...@gmail.com> wrote:
>
> > Hi everyone,
> > I am running into the following issue. The validation plugin allows to
> > check and make sure that at least one of a group of checkboxes is
> > checked, but for that to work I have to call all of them the same
> > name. Validation works great when I do that.
>
> > Only problem is when I submit the form: If more than one box is
> > checked, only the last value will be available (I'm echoing the $_POST
> > [] array in PHP) - this is a predictable behavior from HTML forms -
> > normally you wouldn't call checkboxes the same name unless you want
> > them to behave like radiobuttons.
>
> > Is there a way to validate the group and still call the items
> > different names? Or a way to transform the data before submission so
> > it's similar to having checkboxes with different names?
>
> > Thanks
>
> > pimousse

Reply via email to