submit.php
PHP subor kontaktneho formulara
php
<?php
// Force PHP to use the UTF-8 charset
header('Content-Type: text/html; charset=utf-8');
// Check for empty fields
if(empty($_POST['name'])  		||
   empty($_POST['email']) 		||
   empty($_POST['phone']) 		||
   empty($_POST['message'])	||
   empty($_POST['need'])	||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
	echo "No arguments Provided!";
	return false;
   }
$name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$need = $_POST['need'];
// Create the email and send the message
$to = '[email protected]'; // Add your email address inbetween the '' replacing [email protected] - This is where the form will send a message to.
$email_subject = "Kontaktný formulár:  $need";
$email_body = "Niekto vyplnil formular.<br><br>\n\n"."Detaily:<br><br>\n\nMeno a priezvisko: $name\n\n<br>Email: $email_address\n\n<br>Telefón: $phone\n\n<br><br>Správa:\n$message\n";
$headers = "From: $email_address\n"; // This is the email address the generated message will be from. We recommend using something like [email protected].
$headers .= "Content-type: text/html; charset=utf-8";
mail($to,$email_subject,$email_body,$headers);
return true;
?>
Neformátovaný
    Přidáno: 11.3.2020
    Expirace: Neuvedeno
 
				
