sæt HTML og php sammen
Jeg har lavet denne lommeregner i phphttp://mobz.frac.dk/scripts/lommeregner/2.htm
Men jeg kunne godt tænke mig at have .htm´en og .php´en samlet i php´en.
PHPscriptet:
<?php
$tal = $_REQUEST["tal"];
$taler = $_REQUEST["taler"];
$type = $_REQUEST["type"];
$lig = $tal + $taler;
$lig0 = $tal - $taler;
$lig1 = $tal * $taler;
$lig2 = $tal / $taler;
if($type == tel) {
echo "$tal + $taler = $lig";
} elseif ($type == tell) {
echo "$tal - $taler = $lig0";
} elseif ($type == telll) {
echo "$tal * $taler = $lig1";
} elseif ($type == tellll) {
echo "$tal / $taler = $lig2";
}
?>
HTM´en:
<form action="mobz.php" method=post>
<input type="text" name="tal" size="5">
<select name="type">
<option value="tel">+
<option value="tell">-
<option value="telll">*
<option value="tellll">/
</select>
<input type="text" name="taler" size="5"><p>
<p>
<input type=submit value="Fordøj">
</form>
Nogen der kan hjælpe mig?
