Streaming live at 10am (PST)

[Tutorial] PHP Contact Form (External Hosting)


#1

If you do not want to use the webflow forms you can use PHP, its free :slight_smile:

This is the form that you must attach to your index.html in the section

<form action="mail.php" method="POST">
<p>Name</p> <input type="text" name="name">
<p>Email</p> <input type="text" name="email">
<p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
<input type="submit" value="Send"><input type="reset" value="Clear">
</form>

Now, you must create a php file with the name “mail.php” in the root (folder that you have index.html)

<?php $name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "emailaddress@here.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>

Change: recipient: emailaddress@here.com and write your email… READY!
(You can change “thank you” por another html page (copy&paste) you make for a success form sent.)


#2

Also, creating a custom php contact form on your own is not that difficult. Once you have a main contact form script, you can always add more things to it, like recaptcha, custom validation and authentication, etc.


#3

This seems to work great on my cPanel server on Webflow contact forms. Do you know how to add some spam controls like ReCaptcha or honeypot without breaking anything? Trying to keep it simple and easily reusable. Thanks.