Good morning, folks.
I have a question here.
I have three select. Brings first product, quantity brings Second, Third brings value.
These are more select muntiplos as an array;
Ex:
$quantity = "1,2,3";
$value = "20.00,30.00,20.00";
Foreach had to do it.
qty value
$S ="1 * 20.00";
$S ="2 * 30.00";
$S ="1 * 20.00";
I am sending the page to have two to do the calculation.
More not getting to do two foreach with the data value and quantity.
Anyone know how I can sum this Vazer?
I would be very grateful.
EX:
<select class="product" name=product[]" id="product[]">
<option value="1"> Plan 1 </ option>
<option value="2"> Plan 2 </ option>
</ select>
<select class="quantity" name=quantity[]" id="quantity[]">
<option value="1"> 1 </ option>
<option value="2"> 2 </ option>
</ select>
<select class="value" name=value[]" id="value[]">
<option value="1"> 20:00 </ option>
<option value="2"> 30.00 </ option>
</ select>
Post
$quantity = $_POST["quantity"];
$value = $_POST["value"];
$quantity = explode(',', $quantity_e);
$value = explode(',', $value_e);
foreach ($quantity as $q && $value as $v) { // ???
$v = $v * $q; // ????
}
Well, first of all, you’re not going to get any relevant information from your selects. Your 3 input arrays will look like this
You are not passing anythign but 1’s and 2’s because the
valueattribute of all of your options is set to only 1’s and 2’s.You can either remove the
valueattribute all together and it will pass the text in options, or you could setvalueto the actual value you want to pass.Once you have the data in to format you originally specified, something like this would accomplish what I believe to be your goal.