<?php
// MySql Config
$db_host = "localhost";
$db_user = "*****";
$db_pass = "*****";
$db_name = "*****";
$table = "tabelle1";
$link = mysql_connect("$db_host","$db_user","$db_pass");
mysql_select_db("$db_name",$link);
echo "<table><form action=\"$PHP_SELF\" method=post><tr>";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">";
echo "<td>Name:</td><td><input type=text name=name></td></tr><tr>";
echo "<td>Telefonnummer:</td>";
echo "<td><input type=text name=telefonnummer></td>";
echo "</tr><tr><td></td>";
echo "<td><input type=submit value=\"Eintragen\"></td></tr></form></table>";
if (action=="save") {
mysql_query("insert into $table (id,name,telefonnummer) VALUES ('$id','$name','$telefonnummer')");
header("Location: ".$PHP_SELF); }
$query = "select * from $table";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
while($row = mysql_fetch_array($result)) {
echo "ID des User = $id sein Name ist $name und seine Telefonnummer ist $telefonnummer
";
echo "
-----------------------------
";
}
} else {
echo "Bis jetzt gab es keine Einträge";
}
?>