I have a checkbox coded in HTML, so far everything works, however I need to pass in an array in the name attribute of the checkboxes. I know its easy enough to do when you pass a variable into the name attribute. But for arrays it is proving tricker.
Here is my code:
<?php // spit out rest of the list
$permiCheck = array();
foreach($pList as $value){
//go into array, get what is needed to pass into the name attribute
echo '<tr>';
echo '<td>';
echo $value['PName'];
echo '</td>';
//pass an array in
$permiCheck['Id'] = $value['Id'];
$permiCheck['ItemId'] = $value['ItemId'];
if($value['Id']!=null) {
?>
<td style="text-align:center;"> <input type="checkbox" checked="yes" name="<?php $permiCheck;?>" value="" id="change"></td>
After I have done this I intend to retrieve what was in the array via the POST method for form validation.
Any idea how I can do that, many thanks.
The name of the checkbox element has to be a string, you can however use checkboxes as an array.
i.e.
will return
I’m not sure what you’re trying to do, but maybe you could do it this way