Streaming live at 10am (PST)

[Tutorial] PHP Contact Form (External Hosting)


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">

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 = "";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";

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


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.


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.