I wrote below code by php In this code I want to calculate water bill
but when I press the button, the result does not show where is proplem. Knowing I want to use the value that the user enters.
<!DOCTYPE html>
<html>
<body>
<form>
القيمة: <input type="text" name="cal"><br>
<button onclick="myFunction("cal")">إحسب التكلفة</button>
</form>
<script>
function myFunction($x) {
$x=$x%1000;
if($x<=15){
$x=$x*0.10;
return $x;}
elseif($x>=16&&$x<=30){
$x=$x*1.00;
return $x;}
elseif($x>=31&&$x<=45){
$x=$x*3.00;
return $x;}
elseif($x>=46&&$x<=60){
$x=$x*4.00;
return $x;}
else{
$x=$x*6.00;
return $x;}
}
</script>
</body>
</html>