You need to merge your code with what has been provided...
<?php
// FUNCTIONS //
function area($a,$b) {
return $a*$b;
}
function perimeter($a,$b) {
echo "Length: " . $a . "<br/>";
echo "Width : " . $b . "<br/>";
echo "Perimeter: " . (2 * ($a + $b)) . "<br/>";
echo "Area : " . area($a,$b);
return;
}
?>
<html>
<body>
<h1>PHP-sida 4</h1>
<form action="php4.php" method="post">
<p>Längd: <input type="text" name="length" size="20" /></p>
<p>Bredd: <input type="text" name="width" size="20" /></p>
<p><input type="submit" value="CALCULATE" name="calc" /></p>
</form>
<?php
if (isset($_POST['calc']) && !empty($_POST['length']) && !empty($_POST['width'])) {
echo 'Processing...<br/>';
echo perimeter($_POST['length'],$_POST['width']);
} else {
echo 'You need to specify a length and a width.';
}
?>
</body>
</html>