Hallo !
I’m comming back with a very last question about changing a variable depending on check radio button, and it’s a PHP oriented issue.
I’m using a basic function to calculate $postage
price. This postage depends on the $total
. But instead of this, I would to be able to calculate $postage
with three differents choices : France/Europe/Monde, three radio buttons.
This is my actual function
function cart_postage($total) {
$postage;
switch ($total) {
case ($total < 2): // entre 0 et 2
$postage = 5;
break;
case ($total < 5): // entre 2 et 5
$postage = 10;
break;
case ($total < 10): // entre 5 et 10
$postage = 5.5;
break;
case ($total < 30): // entre 10 et 30
$postage = 10;
break;
default:
$postage = 1;
}
return $postage;
}
and my buttons
<label class="france"><input type="radio" id='france' value="10" value="France"/>France</label>
<label class="europe"><input type="radio" id='europe' value="15" value="Europe"/>Europe</label>
<label class="monde"><input type="radio" id='monde' value="20" value="Monde"/>Monde</label>
The idea is : if I click on “Europe”, the $postage
price is refreshing to its value : 15.
I already tried something with param()
and isset
but it was a total disaster.
If you have some times to help me, or some advices, it could be great !