All pastes #230975 Raw Edit

Runar

public php v1 · immutable
#230975 ·published 2006-10-31 15:04 UTC
rendered paste body
<div style="width:400px;text-align:center">	<form action="index.php" method="get">Første nummer: <input type="text" name="first" maxlength="6"><br/>Andre nummer: <input type="text" name="second" maxlength="6"><br/><br/><!--Type:<select name="type">	<option value="pluss">Pluss</option>	<option value="minus">Minus</option>	<option value="dele">Dele</option>	<option value="gange">Gange</option></select><br/><br/>--><input type="submit" name="type" value="Pluss"><input type="submit" name="type" value="Minus"><input type="submit" name="type" value="Dele"><input type="submit" name="type" value="Gange"></form><?php$startBox = "<div style=\"margin:0 auto;padding:5px;width:250px;border:1px dashed black;background:#ccc\">";$errorBox = "<div style=\"margin:0 auto;padding:5px;width:250px;border:1px dashed black;background:#fa9494\">";$sluttBox = "</div>";$type = $_GET['type'];function tall($notall = "Plz write numberz!") {	print $notall;}if (ctype_digit($_GET['first'])) {	$first = $_GET['first'];}else {	echo "$errorBox";	echo "<span style=\"color:red;font-weight:bold\">Only numberz!!</span>";	echo "$sluttBox";	exit();}if (ctype_digit($_GET['second'])) {	$second = $_GET['second'];}else {	echo "$errorBox";	echo "<span style=\"color:red;font-weight:bold\">Only numberz!!</span>";	echo "$sluttBox";	exit();}// regne ut $first og $secondswitch ($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;}?>