Hello !
How can I send the data from these two fields and print a datute in the following way?
// from here i need to take product id
<input type="checkbox" name="qty['.$getColorTitle['uniqueID'].']" class="css-checkbox pColor" value="" id="cb-'.$getColorTitle['uniqueID'].'" />
<label for="cb-'.$getColorTitle['uniqueID'].'">
<img src="'.$colorFolder.''.$rowColors['image'].'" height="50px" />
<div class="colorsC">
// from here i need to take quantity
<input type="hidden" name="qty['.$getColorTitle['uniqueID'].']" value="0" style="width: 45px;" class="qtyC" />
</div>
</label>
if($_SERVER['REQUEST_METHOD'] == 'POST') {
switch($_POST['action']) {
case 'C':
foreach($_POST['qty'] as $color_id=>$quantity) {
if($quantity > 0) {
$_SESSION['cart'][$_POST['product_id']][$color_id] = $quantity;
} else {
unset($_SESSION['cart'][$_POST['product_id']][$color_id]);
}
}
break;
}
}
The way to print:
Color 1, Quantity 6
Color 2, Quantity 1
Color 3, Quantity 1
Color 4, Quantity 1
There may be another method, but I personally took a look at this, because by choosing a color, the jQuery field opens the quantity field. If it is not selected, it is hidden.
Thanks !