Best way to make if statements
Basically I am getting values from checkboxes (i.e. how many check boxes
checked in a form). What I need to happen is echo a price for a certain
number values. Here is what I was thinking but not sure if its the correct
way to do it:
$clubTotal = array(
$driversChecked,
$hybridsChecked,
$woodsChecked,
$boxesChecked,
$wedgesChecked,
);
$numberOfclubs = array_sum($total)
if ($numberOfclubs > 6)
echo "price";
if ($numberOfclubs == 6)
echo "price";
if($numberOfclubs > 6 && $numberOfclubs < 9)
echo "price";
I am sure that will work the way I need, just not sure if there is a
shorthand or better way to write it. Thanks.
No comments:
Post a Comment