Jeg kan ikke få min gæstebog til at virke.
Min kode ser sådan ud:
<html>
<head><title>Gæstebog test!</title></head>
<body>
<?
$db = mysql_connect("localhost","sfwebdesign","asDfgH12");
mysql_select_db("sfwebdesign",$db);
if ($skriv) {
$besked = str_replace("\\n","<br />",$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" /><br />
Email: <input type="text" name="email" /><br />
<textarea name="besked" cols="30" rows="5"></textarea><br />
<input type="submit" value="Send">
</form>
<br />
<br />
<table>
<?
$foresp = mysql_query("SELECT navn, email, dato, besked FROM gbog ORDER BY id DESC");
while($data = mysql_fetch_row($foresp)){
echo "<tr><td>";
echo "Fra <a href=\\"mailto:$data[1]\\">$data[0]</a>";
echo "<br />$data[2]";
echo "</td><td>$data[3]</td></tr>";
}
?>
</table>
</body>
</html>
Resulatet kan sees her:
http://sfwebdesign.uhost.dk/test/gbtest.php
Indlæg senest redigeret d. 05.06.2007 13:12 af Bruger #10113