PHP Tutorial : Tell a friend script
Dec 21, 2008 Useful PHP
Hi,
In this php tutorial I’ll teach you how to create a simple tell a friend script. Basically, it will use what you learned in the send email with a contact form script, but in this case we’ll choose the destination and also the “from:” field which we’ll setup on php mail() function headers.
<form action="" method="post"> Your email address : <input type="text" name="yemail"><br/> Your friend's email address : <input type="text" name="femail"><br/> Your message : <textarea name="text">Hey look what nice website I found <?=$_SERVER['SERVER_NAME'];?> </textarea> <input type="submit" name="sb" id="sb" value="Tell a friend"> </form> <?php //check if tell a friend form was completed and sended if(isset($_POST['sb'])) { if($_POST['yemail'] == "" || $_POST['femail'] == "" || $_POST['text'] == "") { print "All fields are mandatory"; }else{ $to = $_POST['femail']; $from = "From : $_POST[yemail]"; $message = $_POST['text']; $subject = "Your friend tells u"; mail($to, $subject , $message, $from); } } ?>
Tags: html tell a friend, php tell a friend, tell a friend, tell a friend form, tell a friend script


January 21st, 2009 at 11:52 am
I Think You’re A Good Webmaster, It’s Hard To Find The Simple Way To Teach People Somethings Like this Script, I Have To Say WOW!!!