<?php
if(isset($_POST['submit'])){
$to = "adres na który wysyłam"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$tel = $_POST['tel'];
$kod = $_POST['kod'];
$content = $_POST['message'];
test_input($from);
test_input($tel);
test_input($kod);
test_input($content);
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message = "Numer telefonu: " . $tel . "Kod Pocztowy: " . $kod . "Wiadomość: " . "\n\n" . $content;
$message2 = "Here is a copy of your message: " . "Numer telefonu: " . $tel . "Kod Pocztowy: " . $kod . "Wiadomość: " . "\n\n" . $content;
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<form action="" class="first-part__form" method="post">
<input type="tel" name="tel" required class="first-part__input" placeholder="NR TELEFONU*" title="Podaj numer telefonu" autofocus>
<input type="text" name="kod" pattern="[0-9]{2}\-[0-9]{3}" title="FORMAT XX-XXX" class="first-part__input" placeholder="KOD POCZTOWY">
<input type="email" name="email" class="first-part__input" required placeholder="EMAIL*" title="Podaj email">
<input type="text" name="message" class="first-part__input" required placeholder="WIADOMOŚĆ*" title="Wpisz wiadomość">
<input type="submit" class="first-part__submit" value="Wyślij">
</form>
Wszystko umieszczone jest w pliku index.php
ten skrypt php umieszczony jest nad <form>
Chcę też, żeby wszystko dobywało się na tej stronie.
Skrypt ma wysłać maila, jednak maila nie wysyła, ani w jedną, ani w drugą stronę