Hi all,

I have used the checkboxes in my page as given below

<input type="checkbox" name="chkboxarray" value=1>
<input type="checkbox" name="chkboxarray" value=2>
<input type="checkbox" name="chkboxarray" value=3>

If all the checkboxes are selected then how can we get the values of individual checkbox in php during a form submission. Anyone have idea for this?

<input type="checkbox" name="chkboxarray[b][][/b]" value=1>
<input type="checkbox" name="chkboxarray[b][][/b]" value=2>
<input type="checkbox" name="chkboxarray[b][][/b]" value=3>

To access them as a group:

foreach ($_REQUEST['chkboxarray'] as $checkbox)
     echo $checkbox;

Hi Stymiee,

Thanks for your kind reply. I have mentioned checkbox name as an array like chkboxarray[] and then get the individual value from the checkbox.


Since they all share the same name you can't get them individually. You'll need to look for the value of each and base your actions on that. Your only alternative is to give each one a unique name in your HTML.

This question has already been answered. Start a new discussion instead.