";
$errorBox = "";
$sluttBox = "
";
$type = $_GET['type'];
function tall($notall = "Plz write numberz!") {
print $notall;
}
if (ctype_digit($_GET['first'])) {
$first = $_GET['first'];
}
else {
echo "$errorBox";
echo "Only numberz!!";
echo "$sluttBox";
exit();
}
if (ctype_digit($_GET['second'])) {
$second = $_GET['second'];
}
else {
echo "$errorBox";
echo "Only numberz!!";
echo "$sluttBox";
exit();
}
// regne ut $first og $second
switch ($type) {
case "Pluss":
$resultat = $first + $second;
echo "$startBox";
echo "Resultat: $first + $second = $resultat";
echo "$sluttBox";
break;
case "Minus":
$resultat = $first - $second;
echo "$startBox";
echo "Resultat: $first - $second = $resultat";
echo "$sluttBox";
break;
case "Dele":
$resultat = $first / $second;
echo "$startBox";
echo "Resultat: $first / $second = $resultat";
echo "$sluttBox";
break;
case "Gange":
$resultat = $first * $second;
echo "$startBox";
echo "Resultat: $first x $second = $resultat";
echo "$sluttBox";
break;
}
?>