eingabe.html
<form method="post" action="eingabe.php">
<pre>
Name: <input type="text" name="name" size="20" maxlength="30">
</pre>
<input type="submit" name="absenden" value="Absenden">
<input type="reset" name="loeschen" value="Eingaben löschen">
</form>
eingabe.php
$name =$HTTP_POST_VARS['vorname'];
$dbzugang = mysql_connect("
localhost","user","pw");
mysql_select_DB("freunde",$dbzugang);
mysql_query("INSERT INTO telefonliste (Name) VALUES ('$name'));
mysql_close($dbzugang);
ausgabe.php
$dbzugang = mysql_connect("
localhost","user","pw");
mysql_select_DB("freunde",$dbzugang);
$
sql = mysql_query("SELECT * FROM telefonliste",$dbzugang);
while ($attribut=mysql_fetch_row($
sql)){
echo "
$attribut[0], $attribut[1], $attribut[2], $attribut[3]";}
mysql_close($dbzugang);
suchen.php (siehe eingabe.html)
$dbzugang = mysql_connect("
localhost","user","pw");
mysql_select_DB("freunde",$dbzugang);
$suchname =$HTTP_POST_VARS['name'];
$
sql = mysql_query("SELECT * FROM telefonliste where name like '".$suchname."%'",$dbzugang);
echo "
";
while ($attribut=mysql_fetch_row($
sql)){
printf("Nr: %s
Name: %s
Vorname: %s
Telefon: %s
",
$attribut[0], $attribut[1], $attribut[2], $attribut[3]);}
mysql_close($dbzugang);
Rechnen:
$a = $_GET['a'];
$b = $_GET['b'];
$addi = $a + $b;
echo "Addition: $addi
";