Her er hele koden:
<html>
<head><title>Heymann's Gæstebog</title></head>
<body>
<?
$db = mysql_connect("*******", "*******",
"*********");
mysql_select_db("*********", $db);
if($_POST["skriv"]){
$navn = $_POST["navn"];
$email = $_POST["email"];
$besked = $_POST["besked"];
if(!get_magic_quoten_gpc()){
$navn = addslashes($navn);
$email = addslashes($email);
$besked = addslashes($besked);
}
$dato_array = getdate();
$dato = $dato_array["mday"] ."/".
$dato_array["mon"] ."-".
$dato_array["year"];
mysql_query("INSERT INTO gbog (navn, email,
dato, besked) VALUES ('$navn', '$email',
'$dato', '$besked')");
}
?>
<form method="post" action="<? echo $PHP_SELF; ?>">
<input type="hidden" name="skriv" value="1">
Navn:<input type="text" name="navn">
Email:<input type="text" name="email">
Besked:<textarea name="besked" cols="30" rows="5"></textarea>
<input type="submit" value="send">
</form>
<table>
<?
$foresp = mysql_query("SELECT navn, email, dato, besked FROM gbog ORDER BY id DESC");
while($data = mysql_fetch_array($foresp)){
echo "<tr><td valign=\\"top\\">";
echo "Fra: <a href=\\"mailto:";
echo $data["email"];
echo "\\">";
echo $data["navn"];
echo "</a>";
echo "";
echo $data["dato"];
echo "<tr><td valign=\\"top\\">";
echo nl2br($data["besked"]);
echo "</td> </tr>";
}
?>
</table>
</body>
</html>
--------------------Reklame--------------------
http://www.heymann.1go.dk/nyt/ --------------------Reklame--------------------
[Redigeret d. 18/12-05 21:03:42 af Per]