QUOTE(pandy @ Sep 12 2019, 04:47 PM)
There are oodles of ready-made form handling scripts.
Here you find a bunch in PHP. Check the corresponding category for other languages.
https://www.hotscripts.com/category/scripts...orm-processors/Take a little care choosing one though, read comments, google. There are probably still vulnerable scrips around.
Thanks for your response. I found a free script i like, and have modified it, does it look correct?
PS*** I KNOW SCRIPT WONT WORK ON LOCAL COMPUTER WHICH IS FINE***
Just need it to be good for live launch
Heres the script i modified...
<?php
$errors = '';
$myemail = 'ifixitforyou70@gmail.com';//<-----Put Your email address here.
if(empty($_POST['fullname']) ||
empty($_POST['email']) ||
empty($_POST['enjoy']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['fullname'];
$email_address = $_POST['email'];
$message = $_POST['enjoy'];
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$from = 'effb@hotmail.com';
$to = 'ifixitforyou70@gmail.com';
$email_subject = "Thank you for subscribing: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n Email: $email_address \n Did they enjoy the site? : $message";
$headers = "From: $myemail\n";
$headers = "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
}
?>
<!DOCTYPE HTML>
<html lang="en" target="_blank">
<head>
<title>Thank You!</title>
</head>
<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
</body>
</html>
And the html it refers to:
<form name="subscribe" class="formz" action="contact-form-handler.php" method="post">
<p class="formtext">Your Name</p><input type="text" name="fullname" placeholder="What is your name?" required>
<p class="formtext">Your Email</p><input type="text" name="email" placeholder="What is your email address?" required>
<p class="formtext">Did you enjoy the site?</p>
<label class="yesandno">
<input type="checkbox" name="enjoy">
<span class="slider"></span>
</label><button type="submit">Submit</button>
</form></center>