öffnen einer php Datei
Pierre
- php
Wie kann ich über einen Link eine php Datei (mail) ausführen?
Wenn ich es wie folgt schreibe dann öffnet sich nur diese Datei.
<p><a href="formmail.php4">test</a></p>
Gruß Pierre
Hallo Pierre
Wie kann ich über einen Link eine php Datei (mail) ausführen?
Wenn ich es wie folgt schreibe dann öffnet sich nur diese Datei.
<p><a href="formmail.php4">test</a></p>
Durch das öffnen der Datei wird diese Datei auch ausgeführt.
Es sein den du meinst mit öffnen, das der Quellcode(mit PHPCODE) angezeigt wird und nicht das erzeugte Ergebniss(HTML ohne PHPCODE), dann ist dein Webserver nicht für PHP kofiguriert.
Was ist bei Dir der Fall?
Salut,
Christoph
Das komische ist nur wenn ich dieses Script über ein Formular laufen lasse funktioniert es.Nur nicht wenn ich es über einen href Befehl starten möchte.
HTML Seite
<html>
<head>
<title>email</title>
</head>
<body>
<form method="POST" action="formmail.php4">
<p><input type="submit" value="speichern" name="B1"></p>
<input type="hidden" name="recipient" value="bindu75@web.de"><input type="hidden" name="subject" value="Ergebnisse">
</form>
<p><a href="formmail.php4" name="bindu75@web.de" value="bindu75@web.de">>test</a></p>
</body>
</html>
Das Script sieht so aus:
<?php
header("status: 204 No Content");
$fmtResponse= implode("", file("response.htt"));
$fmtMail= implode("", file("mail.txt"));
foreach($HTTP_POST_VARS as $key=> $val) {
$fmtResponse= str_replace("<$key>", $val, $fmtResponse);
$fmtMail= str_replace("<$key>", $val, $fmtMail);
}
mail($HTTP_POST_VARS["recipient"], $HTTP_POST_VARS["subject"], $fmtMail);
echo $fmtResponse;
?>
Hallo Pierre
Hier ist der Fehler.
<p><a href="formmail.php4" name="bindu75@web.de" value="bindu75@web.de">>test</a></p>
du musst den value als Variable übergeben.
<a href="formmail.php4?recipient=bindu@web.de&subject=Ergebnisse">
Ich hoffe mal so funktionierts.
Salut,
Christoph
Hi
noch was.
<?php
header("status: 204 No Content");
$fmtResponse= implode("", file("response.htt"));
$fmtMail= implode("", file("mail.txt"));
foreach($HTTP_POST_VARS as $key=> $val) {
$fmtResponse= str_replace("<$key>", $val, $fmtResponse);
$fmtMail= str_replace("<$key>", $val, $fmtMail);
}
mail($HTTP_POST_VARS["recipient"], $HTTP_POST_VARS["subject"], $fmtMail);
echo $fmtResponse;
?>
es kann sein das du $HTTP_PODT_VARS
mit $HTTP_GET_VARS im script ersetzen muß, wenn du meinen Methode, mail vorher anwendest.
Ich hoffe ich habe jetzt nicht noch mehr Probleme geschaffen habe, als du vorher hattest.
Salut,
Christoph
Hallo Christoph
Erstmal ein gaaanz großes Dankeschön. Es hat funktioniert.
Man bin ich froh das dieses Kind endlich geboren ist.
Gruß Pierre
Hallo Pierre
Erstmal ein gaaanz großes Dankeschön. Es hat funktioniert.
Man bin ich froh das dieses Kind endlich geboren ist.
da bin ich ja froh, daß ich auch mal jemandem helfen konnte.
Danke fürs Danke.
Salut,
Christoph