PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Was is hier falsch?


master_knolle
26.03.2008, 17:19:10
hallo,
will ein gästebuch erstellen, doch wenn ich das formular abschicke, wird trotzdem nichts eingetragen.
mein gb besteht aus:
eintrag.html
gaestebuch.php
start.html


eintrag.html (is das formular):

<html>
<head>
<title>Gästebuch</title>
<body>
<div style="font-family:arial;background-color:yellow; text-align:center">
<h2>Ihr Eintrag in unser Gästebuch</h2>
Bitte alle Felder ausfüllen!
</div>
<div style="font-family:arial;background-color:#008000; text-align:center">
<form action="gaestebuch.php" method="post">
<table border="0">
<tr>
<td>Name</td>
<tr><td><input type="text" name="nachname"></td>
<td>Email</td>
<tr><td><input type="text" name="mail"></td>
<td>Text</td>
<td><textarea name="text" cols="40" rows="5"></textarea></td>
<tr>
<td><input type="submit" value="Abschicken">
<input tyle="reset" value="Abbrechen"></td>
</table>
</form>
</div>
</body>
</html>

----------------------------------------------------------------------------------------------------------
gaestebuch.php (auswertung formular):

<html>
<head>
<title>Gästebuch</title>
</head>
<body>
<?php
$nachname=$HTTP_POST_VARS['nachname'];
$mail=$HTTP_POST_VARS['mail'];
$kommentar=$HTTP_POST_VARS['mail'];
$punkt=".";
$dpunkt=":";

//datum und zeit
$datum=date('d');
$datum.=$punkt;
$datum.=date('m');
$datum.=$punkt;
$datum.=date('Y');
$zeit=date('G');
$zeit.=$dpunkt;
$zeit.=date('i');
$zeit.=$dpunkt;
$zeit.=date('s');

//neuer eintrag
$eintrag="<!--start-->\n";$eintrag.="<p><div style='font-family:arial; font-size:10;'><b>Name:</b>";
$eintrag.=$nachname;
$eintrag.="<br>\n<b>Email:</b><a href='mailto:";
$eintrag.=$mail;
$eintrag.="'>";
$eintrag.="</a><br>\n Datum:";
$eintrag.=$datum;
$eintrag.=" um ";
$eintrag.=$zeit;
$eintrag.="<br>\n Text:";
$eintrag.=$kommentar;
$eintrag.="</div></p><br><br>\n";

//gb-file laden
$bol=file_exists("start.html");
if($bol) {
$datei=fopen("start.html", "r");
if ($datei) {
$dateigroesse=filesize("start.html");
$inhalt=fread ($datei, $dateigroesse);
fclose($datei);
}
//neuen eintrag einfügen
$ersetzen=str_replace('!--start--', $eintrag, $inhalt);
}

//gb aktuell
$bol=file_exists("start.html");
if($bol) {
$datei=fopen('start.html', 'w');
if($datei) {
$output=fwrite($datei, $ersetzen);
fclose($datei);
}
}
?>
<br><br>
<a href="start.html">zu den einträgen</a>
</body>
</html>

---------------------------------------------------------------------------------------------------------

start.html (einträge):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Gästebuch</title>
</head>
<body>
<div style="font-family:arial; text-align:center; background-color:orange;">
<b>Gästebuch</b><br><br><br>
<a href="eintrag.html">Eintrag</a>
</div><br>

<!---start-->
<p>
<div style="font-family:arial"><b>Name:</b>xxx<br>
<b>Email:</b><a href="mailto:m@m.de">m@m.de</a><br>
<b>Datum:</b> 25.3.2008 um 20:40<br>
<b>Text:</b>Hallo!
</div>
</p><br><br>
</body>
</html>


--------------------------------------------------------------------------------------------------------

ich hoffe, hier kann jemand helfen.

danke im vorraus.

|Coding
26.03.2008, 20:27:19
Benutze bitte die Forums-Tags, wenn Du Code postest:

- http://www.selfphp.de/forum/misc.php?do=bbcode#php
- http://www.selfphp.de/forum/misc.php?do=bbcode#html

master_knolle
26.03.2008, 21:13:44
is jetzt überall php-code. stimmt, so is es natürlich einfacher zu lesen.


eintrag.html (is das formular):


<html>
<head>
<title>Gästebuch</title>
<body>
<div style="font-family:arial;background-color:yellow; text-align:center">
<h2>Ihr Eintrag in unser Gästebuch</h2>
Bitte alle Felder ausfüllen!
</div>
<div style="font-family:arial;background-color:#008000; text-align:center">
<form action="gaestebuch.php" method="post">
<table border="0">
<tr>
<td>Name</td>
<tr><td><input type="text" name="nachname"></td>
<td>Email</td>
<tr><td><input type="text" name="mail"></td>
<td>Text</td>
<td><textarea name="text" cols="40" rows="5"></textarea></td>
<tr>
<td><input type="submit" value="Abschicken">
<input tyle="reset" value="Abbrechen"></td>
</table>
</form>
</div>
</body>
</html>


----------------------------------------------------------------------------------------------------------

gaestebuch.php (auswertung formular):


<html>
<head>
<title>Gästebuch</title>
</head>
<body>
<?php
$nachname=$HTTP_POST_VARS['nachname'];
$mail=$HTTP_POST_VARS['mail'];
$kommentar=$HTTP_POST_VARS['mail'];
$punkt=".";
$dpunkt=":";

//datum und zeit
$datum=date('d');
$datum.=$punkt;
$datum.=date('m');
$datum.=$punkt;
$datum.=date('Y');
$zeit=date('G');
$zeit.=$dpunkt;
$zeit.=date('i');
$zeit.=$dpunkt;
$zeit.=date('s');

//neuer eintrag
$eintrag="<!--start-->\n";$eintrag.="<p><div style='font-family:arial; font-size:10;'><b>Name:</b>";
$eintrag.=$nachname;
$eintrag.="<br>\n<b>Email:</b><a href='mailto:";
$eintrag.=$mail;
$eintrag.="'>";
$eintrag.="</a><br>\n Datum:";
$eintrag.=$datum;
$eintrag.=" um ";
$eintrag.=$zeit;
$eintrag.="<br>\n Text:";
$eintrag.=$kommentar;
$eintrag.="</div></p><br><br>\n";

//gb-file laden
$bol=file_exists("start.html");
if($bol) {
$datei=fopen("start.html", "r");
if ($datei) {
$dateigroesse=filesize("start.html");
$inhalt=fread ($datei, $dateigroesse);
fclose($datei);
}
//neuen eintrag einfügen
$ersetzen=str_replace('!--start--', $eintrag, $inhalt);
}

//gb aktuell
$bol=file_exists("start.html");
if($bol) {
$datei=fopen('start.html', 'w');
if($datei) {
$output=fwrite($datei, $ersetzen);
fclose($datei);
}
}
?>
<br><br>
<a href="start.html">zu den einträgen</a>
</body>
</html>


---------------------------------------------------------------------------------------------------------

start.html (einträge):


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Gästebuch</title>
</head>
<body>
<div style="font-family:arial; text-align:center; background-color:orange;">
<b>Gästebuch</b><br><br><br>
<a href="eintrag.html">Eintrag</a>
</div><br>

<!---start-->
<p>
<div style="font-family:arial"><b>Name:</b>xxx<br>
<b>Email:</b><a href="mailto:m@m.de">m@m.de</a><br>
<b>Datum:</b> 25.3.2008 um 20:40<br>
<b>Text:</b>Hallo!
</div>
</p><br><br>
</body>
</html>

Area51
29.05.2008, 21:44:33
Füge mal in der gaestebuch.php direkt nach "<?php" dies ein:
error_reporting (E_ALL);