-
Notifications
You must be signed in to change notification settings - Fork 0
/
form-process.php
56 lines (47 loc) · 976 Bytes
/
form-process.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
$errorMSG = "";
// NAME
if (empty($_POST["name"])) {
$errorMSG = "Imię jest wymagane ";
} else {
$name = $_POST["name"];
}
// EMAIL
if (empty($_POST["email"])) {
$errorMSG .= "Email jest wymagany ";
} else {
$email = $_POST["email"];
}
// MESSAGE
if (empty($_POST["message"])) {
$errorMSG .= "Treść jest wymagana ";
} else {
$message = $_POST["message"];
}
//Add your email here
$EmailTo = "askalandia@gmail.com";
$Subject = "Kontakt ze strony [formularz]";
// prepare email body text
$Body = "";
$Body .= "Imię: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $email;
$Body .= "\n\n";
$Body .= "Wiadomość: \n";
$Body .= $message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From:".$email);
// redirect to success page
if ($success && $errorMSG == ""){
echo "success";
}else{
if($errorMSG == ""){
echo "Coś nie poszło :(";
} else {
echo $errorMSG;
}
}
?>