/ / Formularz kontaktowy PHP, nie wysyłający wszystkich pól e-mailem - php, zmienne, recaptcha, formularz kontaktowy

Formularz kontaktowy PHP nie wysyłając wszystkich pól e-mailem - php, zmienne, recaptcha, formularz kontaktowy

Mam bardzo małe doświadczenie z PHP.

Testuję formularz kontaktowy dla tej strony. Otrzymuję tylko pola "temat, wiadomość i nagłówek" w e-mailu.

Potrzebuję również pola telefonicznego i nazwy, które będę pokazywać w mojej wiadomości e-mail.

Co ja robię źle?

Każda pomoc jest mile widziana, dzięki!

<?php

$name;$email;$message;$captcha;$telephone;
if(isset($_POST["name"])){
$name=$_POST["name"];
}if(isset($_POST["email"])){
$email=$_POST["email"];
}if(isset($_POST["telephone"])){
$telephone=$_POST["telephone"];
}if(isset($_POST["message"])){
$message=$_POST["message"];
}if(isset($_POST["g-recaptcha-response"])){
$captcha=$_POST["g-recaptcha-response"];
}
if(!$captcha){
echo "<h2>Please check the the captcha form. <a href=http://www.website.com#contact/>Back to Form</a></h2>";
exit;
}
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LcYjgcT****q9vhur7iH_O4dZPl4xUAVwW8=".$captcha."&remoteip=".$_SERVER["REMOTE_ADDR"]);
if($response.success==false)
{
echo "<h2>You are spammer ! Get the @$%K out</h2>";
}else
{
// Checking For Blank Fields..
if ($_POST["name"] == "" || $_POST["email"] == "" || $_POST["telephone"] == "" || $_POST["message"] == "") {
echo "Fill All Fields..";
} else {
// Check if the "Sender"s Email" input field is filled out
$email = $_POST["email"];
// Sanitize E-mail Address
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
// Validate E-mail Address
$email = filter_var($email, FILTER_VALIDATE_EMAIL);
if (!$email) {
echo "Invalid Sender"s Email";
} else {
$to = "email@gmail.com";
$subject = "Contact Form";
$message = $_POST["message"];
$name = $_POST["name"];
$headers = "From:" . $email . "rn";
// Sender"s Email
// Message lines should not exceed 70 characters (PHP rule), so wrap it
$message .= "rn Name: " . $name;
$message .= "rn Email: " . $email;
$message .= "rn Telephone: " . $telephone;
$message .= "rn Message: " . $message;
// Send Mail By PHP Mail Function
if (mail($to, $subject, $message, $headers)) {
echo "Your mail has been sent successfully!<a href=http://wwwwebsite.com>Back</a>";
} else {
echo "Failed to send email, try again.";
exit ;
}
}
}

} ?>

Odpowiedzi:

0 dla odpowiedzi № 1

The $message zmienna to treść wiadomości, która zostanie wysłana na twój adres, dodaj wartości, które chcesz umieścić w swojej poczcie do tej zmiennej.

tak: (ponieważ myślę, że nie korzystasz z poczty HTML)

$message .= "rn Name : " . $name;
$message .= "rn Email : " . $email;

itp..

Zanim zadzwonisz mail funkcjonować.

RÓWNIEŻ :

Dodajesz numer telefonu, e-mail i wiadomość w swoim telefonie $email zmienna. powinieneś podać te własne zmienne.