Addition von zwei Zahlen
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Addition</title>
</head>
<body>
<h1>Addition</h1>
<p>Addition von zwei Zahlen</p>
<p><a href="ergebnisliste.php">Alle Ergebnise</a></p>
<form action="index.php" method="POST">
<label for="name">Name: <input type="text" name="name"></label><br>
<label for="z1">Zahl 1: <input type="number" name="z1"></label><br>
<label for="z2">Zahl 2: <input type="number" name="z2"></label><br>
<input type="submit" value="Ausrechnen">
</form>
</body>
</html>
<?php
include("additionconfig.php");
$name = $_POST["name"];
$z1 = $_POST["z1"];
$z2 = $_POST["z2"];
if (isset($name, $z1, $z2)) {
$erg = $z1 + $z2;
$sql = "INSERT IGNORE INTO `liste` (`id`, `name`, `ergebnis`) VALUES (NULL,'$name', '$erg')";
mysql_query($sql) or die("S**t, das war wohl nix <br>".mysql_error());
}
?>