online 1
gast (50)

/ Forum / Skripte(PHP,ASP,Perl...)

Skripte(PHP,ASP,Perl...)Skripte(PHP,ASP,Perl...)

Fragevon nafasi3 vom 21.06.2021, 17:41 Options

Lösung

php Kontaktformular

Not Found
The requested URL /seiten/formmail-php4 was not found on this server.

Hallo, wenn man mein Kontaktformular ausfüllt, dann kommt diese Meldung. Was stimmt hier nicht?


Antwort schreiben

Antwort 1 von gast42 vom 21.06.2021, 21:49 Options

Es gibt keine Datei, die so heißt.

Antwort 2 von smile vom 21.06.2021, 22:48 Options

gast42: Gut, dass du das sagst!

Wenn du das Kontakformular hier reinhaust, kann man die vielleicht helfen.

Antwort 3 von nafasi3 vom 22.06.2021, 13:19 Options

Hallo,

hier ist der Link zu meinem Kontaktformular

http://www.angekommen-in-side.de/seiten/kontakt.html

Müssen die

notok.htt
ok.htt
mail.htt
formmail.php4
kontakt.html

eine bestimmte Reihenfolge auf dem Server haben? Oder ist es grundsätzlich so in Ordnung wenn ich das so auf den Server lade?

Ihr merkt an meiner Frage - es ist Neuland.

Antwort 4 von DeluxeStyle vom 22.06.2021, 13:32 Options

lieft vielleicht daran, dass dein formular auf die formail-php4 zeigt, aber auf die formail.php4 zeigen sollte

Antwort 5 von DaPascha vom 22.06.2021, 16:05 Options

Hallo nafasi3,

du hast zwei Fehler:

1. im <form>-Tag muss der Parameter action geändert werden. Es zeigt auf die Datei "formail-php4", die Datei heißt aber "formail.php4".

2. dein Web-Server unterstützt die php4-Endung nicht. Das merkst du in dem du die Datei "formail-php4" im Browser öffnest.
Merke: PHP-Code darf niemals im Browser zu sehen sein.

Zusammenfassung:
1. Benenne die Datei "formail.php4" zu "formail.php" um.
2. Ändere die Action auf "formail.php".

Gruß DaPascha

Antwort 6 von nafasi3 vom 22.06.2021, 18:25 Options

Vielen Dank für die Rückantwort.
Habe die Datei umbenannt und formmail.php geändert.

Nun kommt als Rückmeldung nach dem Senden:

Method Not Allowed
The requested method POST is not allowed for the URL /seiten/formmail.php.

Habe es schon mit GET und Standard versucht - geht nicht.

Was ist jetzt zu tun?

Antwort 7 von gast42 vom 22.06.2021, 19:15 Options

in der Serverkonfiguration (httpd.conf) schauen, für welche Dateitypen GET und POST erlaubt sind und dafür sorgen, dass Dateien mit der Endung PHP dazugehören (manchmal reichte's aber auch, den korrekten Mimetype für PHP in die htaccess zus chreiben)

Antwort 8 von nafasi3 vom 23.06.2021, 16:24 Options

Danke, dass ihr mich unterstützt.

Es hat sich etwas bewegt.

Nur jetzt kommt trotz ausgefüllter Pflichtfelder (2 Stück) "Pflichtfelder ausfüllen".

http://www.angekommen-in-side.de/seiten/kontakt.html

<?php
$fmtnotok= implode("", file("notok.htt"));
$fmtResponse= implode("", file("ok.htt"));
$fmtMail= implode("", file("mail.htt"));
if (empty($HTTP_POST_VARS["name"])) {
echo $fmtnotok;
} else {
if (empty($HTTP_POST_VARS["email"])) {
echo $fmtnotok;
} else {
foreach($HTTP_POST_VARS as $key=> $val) {
$fmtResponse= str_replace("<$key>", $val, $fmtResponse);
$fmtMail= str_replace("<$key>", $val, $fmtMail);
}
if ($HTTP_POST_VARS["access"] == "prinzing") {
mail($HTTP_POST_VARS["recipient"], $HTTP_POST_VARS["subject"], $fmtMail);
}
echo $fmtResponse;
}
}
?>

Antwort 9 von DaPascha vom 23.06.2021, 17:14 Options

Hi,

du hattest einen logischen Fehler in deinen if-Anweisungen, probiere es so:

<?php
$fmtnotok= implode("", file("notok.htt"));
$fmtResponse= implode("", file("ok.htt"));
$fmtMail= implode("", file("mail.htt"));

if (empty($HTTP_POST_VARS["name"])) {
 echo $fmtnotok;
} 
else if (empty($HTTP_POST_VARS["email"])) {
 echo $fmtnotok;
} 
else {
 foreach($HTTP_POST_VARS as $key=> $val) 
 {
  $fmtResponse= str_replace("<$key>", $val, $fmtResponse);
  $fmtMail= str_replace("<$key>", $val, $fmtMail);
 }
 if ($HTTP_POST_VARS["access"] == "prinzing") {
  mail($HTTP_POST_VARS["recipient"], $HTTP_POST_VARS["subject"], $fmtMail);
 }
 echo $fmtResponse;
}
?> 

Antwort 10 von DaPascha vom 23.06.2021, 17:24 OptionsLösung

Lösung
Nachtrag: Ich entschuldige meine Voreile. Die Logig deines Skripts ist in Ordnung. Die Ursache des Problems ist die $HTTP_POST_VARS-Variable, diese wurde sein PHP5 abgeschafft, und durch die Variable $_POST ersetzt.
Aus diesem Grund werden die Felder als leer gegenzeichnet.

Gruß DaPascha

Antwort 11 von nafasi3 vom 25.06.2021, 14:09 Options

Hallo DaPascha,

kann ich das im Dreamweaver ändern mit dem $_POST oder geht das nur im Editor?

Gruß
nafasi3

Antwort 12 von nafasi3 vom 25.06.2021, 14:12 Options

Hallo DaPascha,
es hat geklappt, es geht!!!
Vielen Dank.

Gruß nafasi3

Antwort 13 von nafasi3 vom 25.06.2021, 14:40 Options

Hallo DaPascha, meine Freude war zu früh.

Warning: Invalid argument supplied for foreach() in /mnt/web5/53/11/51042811/htdocs/side/seiten/formmail.php on line 11

Mein Test-Mail ist bei mir auch nicht angekommen.

Was kann ich tun? Muß noch viel lernen.

Gruß
nafasi3

Antwort 14 von DaPascha vom 29.06.2021, 14:55 Options

Hallo nafasi3,

dieser Fehler kommt, wenn das Array, dass in der foreach-Schleife durchsucht werden soll leer oder gar keins ist.

Hast du die Variable $HTTP_POST_VARS auch in der foreach-Schleife durch $_POST ersetzt?

Gruß DaPascha

Ähnliche Themen

OO in PHP
Naro  28.01.2008 - 58 Hits - 1 Antwort

ist php.exe quasi das selber wie php-cgi.exe?
TByte  04.09.2008 - 65 Hits - 13 Antworten

Kontaktformular, Problem mit der Weiterleitung (Header)
dorionas  16.09.2008 - 59 Hits - 8 Antworten

Apache PHP, PHP wird nicht interpretiert
Kreavis  20.11.2008 - 105 Hits - 2 Antworten

Kontaktformular auf Webseite - Problem
KOR  02.04.2009 - 414 Hits - 5 Antworten

Hinweis

Diese Frage ist schon etwas älter, Sie können daher nicht mehr auf sie antworten. Sollte Ihre Frage noch nicht gelöst sein, stellen Sie einfach eine neue Frage im Forum..

Neue Einträge

Version: supportware 1.9.150 / 10.06.2022, Startzeit:Thu Jan 8 21:07:44 2026