Hi,
I am trying to do this simple program that should calculate the circumference and the area of a rectangle. It should be two different functions and but the output should come from only 1 function. Input comes from a form. What I am having trouble with atm is: The echo does not show if I have it inside the first function and does not print any value if I place it outside the function.
$lenght = $_POST[“lenght”];
$width = $_POST[“width”];
function calculateCircumference($lenght, $width){
$arean=calculateArea($lenght, $width);
$omkrets = $lenght * 2 + $width * 2;
echo "Arean av rektangeln är12313: $arean <br> ";
echo "omkretsen av rektangeln är: $omkrets";
}
function calculateArea($lenght, $width) {
$arean = $lenght * $width;
return $arean;
}
----- My form class below --------
Skriv in längd och bredd för att beräkna omkretsen av rektangel!
längd
bredd
Thanks a lot
//Struggler