PHP Tell A Friend Form & Script


This is a form which a user can fill in if he or she, finds your site interesting. I have also made the php script to go with this form.

The form below is a sample form, and has been disabled.

If you would like to use this script, and would like extra code which will stop spam.

SPAM Protection

Please contact me and I will be more than happy to send it to you OR if you would like me to send it to you for any other PHP forms you have, get in touch.



Tell a friend about this site
Your email

Your Friends email


Script Source


<The Sample Form >

<form action="" method="POST">
<legend>Tell a friend about this site</legend><br />
Your email<br />
<input type="text" name="your_email" value="Your email here" /><br /><br />
Your Friends email<br />
<input type="text" name="friend_email" value="Your friends email here" />
<input type="Submit" value="Tell a friend!" name="Submit" />


<The PHP Script >


if (isset($_POST['Submit'])) {
// This will check to see if the form has been submitted

$senders_email = $_POST['your_email'];
// The person who is submitting the form

$recipient_friend = $_POST['friend_email'];
// The forms recipient

mail($recipient_friend,"A message from $senders_email", "Dear $recipient_friend,\n\nYour friend $senders_email, found our site very useful, and thought you would be interested.\n\nPlease follow the link to view our site:\n\n\nThank You\n\nThe Team", 'From: "your_site" <>');

if (isset($_POST['your_email'])) {
echo "<br>Your friend $recipient_friend has been contacted <br><br> Thank you for your support $senders_email";
// This will display a confirmation message to say that the form has been submitted

// Script by
// Copyright 2016
// Please leave in place


Please let me know if this script was helpful to you.