php adding up checkboxs
I have a list of check boxs that are displaying right and retunring the
values of all that are checked. I use that in one part of my code but
would also like to get the number or boxes check. The checkboxes are like
so:
<div id="ironSet">
Include in Set
<input type="checkbox" name="iron[]" value="3" />
<span class="smallfont">3</span>
<input type="checkbox" name="iron[]" value="4" />
<span class="smallfont">4</span>
<input type="checkbox" name="iron[]" value="5" />
<span class="smallfont">5</span>
<input type="checkbox" name="iron[]" value="6" />
<span class="smallfont">6</span>
<input type="checkbox" name="iron[]" value="7" />
<span class="smallfont">7</span>
<input type="checkbox" name="iron[]" value="8" />
<span class="smallfont">8</span>
<input type="checkbox" name="iron[]" value="9" />
<span class="smallfont">9</span>
<input type="checkbox" name="iron[]" value="PW" />
<span class="smallfont">PW</span>
<input type="checkbox" name="iron[]" value="TW" />
<span class="smallfont">TW</span>
<input type="checkbox" name="iron[]" value="SW" />
<span class="smallfont">SW</span>
</div>
I echo these values in a php review form like so
$iron = join(", ", $_REQUEST["iron"]);
echo (!empty($_REQUEST['iron'])) ? "<div class='reviewItem'><span
class='reviewTitle'>In Set:</span>{$iron}</div>" : "";
This would return the values, if any, for all that are checked. Is there a
way I can get the number of "iron[]" boxes check as will and store it in
another variable? I am trying to multiply the number of boxes checked by a
price variable.
No comments:
Post a Comment