I am using a script that has a foreach loop and this shows the right amount of checkboxes depending on what is set in the admin area of Magento.
The problem that I am facing is that there may be multiple checkboxes however only the checkbox that is selected nearest the top is the value that is sent with the form. I need all the checkbox values that have been selected to be sent.
This is what I have in my mail script to get the checkboxes values $check = $_POST['check'];
And this is the code below that uses the foreach to show the right amount of checkboxes.
<?php
$SKU = "1282670_01";
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$SKU);
if($product->getTypeId() == "configurable"){
$childs = $product->getTypeInstance()->getUsedProducts();
}
$i = 0;
foreach ($childs as $child) { ?>
<?php $colour_name = $child->getAttributeText('real_colour'); ?>
<li class="notranslate focused" id="fo143li2">
<fieldset>
<div>
<span>
<img width="35" height="35" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $child->getSwatch() ?>">
<input type="checkbox" style="margin-top:-10px;" onchange="handleInput(this);" tabindex="5" value="<?php echo $colour_name ?>" class="field checkbox" name="check" id="<?php echo $colour_name ?>">
<label for="<?php echo $colour_name ?>" class="choice"></label>