Hallo.
Ich bin gerade dabei ein Gästebuch zu machen. Es soll so ablaufen, dass, wenn nicht alle Felder ausgefüllt sind eine Fehlermeldung kommen soll. Wenn eine korrekte Eingabe erfolgt, soll nochmal so eine Art Bestätigung kommen. Leider hab ich irgendwo einen Fehler.
guest_1.htm
<html>
<head>
<title>Bitte tragen Sie sich in unser Gästebuch ein</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="guest" method="post" action="guest_2.php">
<br>
<H2>Ihr Gästebucheintrag:</h2>
<table width="591" border="0" cellspacing="0" cellpadding="5" height="460">
<tr>
<td bgcolor="#999999" align="left" valign="top" height="30" width="74">Name:</td>
<td bgcolor="#CCCCCC" align="left" valign="top" height="30" width="479">
<input type="text" name="name" maxlength="50" size="25">
</td>
</tr>
<tr>
<td bgcolor="#999999" align="left" valign="top" height="30" width="74">E-Mail:</td>
<td bgcolor="#CCCCCC" align="left" valign="top" height="30" width="479">
<input type="text" name="email" maxlength="50" size="25">
</td>
</tr>
<tr>
<td bgcolor="#999999" align="left" valign="top" height="210" width="74">Text:</td>
<td bgcolor="#CCCCCC" align="left" valign="top" height="479" width="210">
<p>
<textarea name="text" cols="45" rows="10"></textarea>
</p>
</td>
</tr>
<tr>
<td bgcolor="#999999" align="left" valign="top" height="30" width="74"> </td>
<td bgcolor="#CCCCCC" align="left" valign="top" height="40" widht="479">
<input type="submit" name="senden" value="Senden">
<input type="reset" name="reset" value="Löschen">
</td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
guest_2.php
<html>
<head>
<title>Datenbankeintrag</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
$datum = date("Y-m-d H:i:s");
$db=@mysql_connect("localhost","root","pl821024")
or die ('Das Gästebuch ist zur Zeit nicht verfügbar.');
if($name!="" && $email!="" && $test!="")
{
else
{
echo "Eintrag wurde nicht vorgenommen, da einige Felder falsch oder unvollständig ausgefüllt wurden!";
}
$eintrag = "INSERT INTO guest (datum, name, email, text) VALUES
('$datum', '$name', '$email', '$text')";
mysql_db_query ("gaestebuch", $eintrag);
mysql_close ($db);
{echo "Ihr Eintrag wurde erfolgreich vorgenommen!";}
?>
<table border="0" cellspacing="2" cellpadding="4">
<tr align="left" valign="top">
<td width="50" bgcolor="#999999">Name:</td>
<td bgcolor="#CCCCCC"><?php echo $name;?></td>
</tr>
<tr align="left" valign="top">
<td width="50" bgcolor="#999999">E-Mail:</td>
<td bgcolor="#CCCCCC"><?php echo $email;?></td>
</tr>
<tr align="left" valign="top">
<td width="50" bgcolor="#999999">Text:</td>
<td bgcolor="#CCCCCC"><?php echo $text;?></td>
</tr>
</table>
</body>
</html>