How would i get the value of the checkboxes that have been selected from these checkboxes created with a loop in php:
<?php
while($rowequipment = mysql_fetch_assoc($sqlequipment)) {
echo '<input type="checkbox" name="equipment[]" value="'.$rowequipment['equipmentid'].'"/>
<input type="text" name="count[]" id="count[]" size="3" value=""/>' .
$rowequipment['description']."<br />";
}
?>
The above commenters are wrong: The name attributes for HTML form elements are of type CDATA. Thus, your code is correct. HTML definition found here.
The
idattributes are useless, unless you need to operate using JavaScript over the DOM tree. In case you just want to process the control’s values using PHP, just drop theids.In case you POSTed data, this iterates over all elements named equipment[]: