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.

thanku..

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.