Jump to content

Tell a friend script


larissahn

Recommended Posts

hi, I have this tell a friend php script. it works, it does send the email, but without any of the fields, like subject, friend's name, message.

here is the code:

 

<?php 

$site_name = "[url=http://www.utilaecology.org]www.utilaecology.org[/url]"; 
$subject = "Tell a friend"; 
$body = "Hello,\r\nYour friend $name ($email) has recommended that you see our website $site_name. He has also sent this message along with the recommendation:\r\n" . $message . "\r\n Thank you,\r\n-The webmaster"; 

if($_POST["send"] == "true") { 
   $to = $_POST["to"]; 
   $name = $_POST["name"]; 
   $email = $_POST["email"]; 
   $message = $_POST["message"]; 
   if (($name == "") OR ($email == "") OR ($message == "")) { 
       print (""); 
       print ("One of the fields was left blank. Please put something in all fields.

"); 
       print ("
"); 
       email_form(); 
   }elseif(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $email)) { 
       $recipient = $to; 
       $subject = $the_subject; 
       $additional_headers = ("From: $email\n"); 
       if(mail($recipient, $subject, $body, $additional_headers)) { 
           print (""); 
           print ("Tell a friend script mailed your friend at $to about $site_name successfully.
Thank you.

"); 
           print ("
"); 
       }else{ 
           print (""); 
           print ("Uh-Oh! Something went wrong with the script! Please try again.

"); 
           print ("
"); 
           $send = "false"; 
           email_form(); 
       } 
   }else{ 
       print (""); 
       print ("That email address does not appear to be valid. Please try again.

"); 
       print ("
"); 
       $send = "false"; 
       email_form(); 
   } 

}else{ 
   print (""); 
   print ("
Tell a friend"); 
   print ("
"); 
   email_form(); 
} 

function email_form(){ 
   global $subject_array, $recipient_array, $this_script, $PHP_SELF; 

   print (""); 
   print ("\n"); 
   print (""); 
   print ("To:
\n"); 
   print (""); 
   print ("
\n"); 
   print (""); 
   print ("Name:
\n"); 
   print (""); 
   print ("
\n"); 
   print (""); 
   print ("Your Email Address:
\n"); 
   print (""); 
   print ("
\n"); 
   print (""); 
   print ("Your Message:
\n"); 
   print (""); 
   print ("
\n"); 
   print (""); 
   print (""); 
   print ("\n"); 
   print (" \n"); 
   print ("\n"); 
   print (""); 
   print ("\n"); 
   print (""); 
   print ("script by leapinglangoor"); 
   print (""); 
   print (""); 
} 
?>

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...