Mam darmowy skrypt PHP&ajax - formularz kontaktowy. Niestety po wrzuceniu na hosting home.pl - nie działa - wyświetla się komunikat "spróbuj ponownie".
Mógłby mi ktoś pomóc w znalezieniu przyczyny? Kod php formularza poniżej:
<?php
// Define some constants
define( "RECIPIENT_NAME", "Imię i nazwisko" ); define( "RECIPIENT_EMAIL", "moj.email@ow.pl" ); define( "EMAIL_SUBJECT", "Zapytanie" );
// Read the form values
$success = false;
$senderName = isset( $_POST['senderName'] ) ?
preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['senderName'] ) : ""; $senderEmail = isset( $_POST['senderEmail'] ) ?
preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['senderEmail'] ) : ""; $message = isset( $_POST['message'] ) ?
preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";
// If all values exist, send the email
if ( $senderName && $senderEmail && $message ) {
$recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">";
$headers = "From: " . $senderName . " <" . $senderEmail . ">";
$success = mail( $recipient, EMAIL_SUBJECT
, $message, $headers ); }
// Return an appropriate response to the browser
if ( isset($_GET["ajax"]) ) { echo $success ?
"success" : "error"; } else {
?>
<html>
<head>
<title>Dziękujemy!</title>
</head>
<body>
<?php if ( $success ) echo "<p>Wiadomość wysłana!.</p>" ?> <?php if ( !$success ) echo "<p>Spróbuj ponownie.</p>" ?> <p>Kliknij wstecz aby wrócić.</p>
</body>
</html>
<?php
}
?>
Ten post edytował Michalo1994 20.08.2014, 20:50:52