PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old November 22nd, 2007, 10:33 AM
Mr. J Mr. J is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 2 Mr. J User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 44 sec
Reputation Power: 0
Question Need "else if" Statement For PHP Script

I have a tell-a-friend PHP script that I'm already using successfully and I want to tweak it so that visitors can optionally send a notice to multiple email addresses.

I've named and added several new fields to the form. Can anyone tell me how to update the script to accomodate this?

I believe these are the attributes in the script which need configuration.

PHP Code:
 $tomail $_POST["friend_email"];

//THE ADDITIONAL EMAIL FIELDS ARE NAMED
//friend_2, friend_3, friend_4, friend_5 

//send the email
mail ($tomail$subject$inputMessage,$from); 



Thanks

Reply With Quote
  #2  
Old November 22nd, 2007, 12:11 PM
Mr. J Mr. J is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 2 Mr. J User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 44 sec
Reputation Power: 0
Perhaps it would also help if I post the entire script below.

PHP Code:
<?php

  $tomail 
$_POST["friend_email"];

  
//THE ADDITIONAL EMAIL FIELDS ARE NAMED
  //friend_2, friend_3, friend_4, friend_5

  
$from $_POST["sender_email"];
  
$copyfrom $_POST["sender_email"];
  
$notifyMail "contact[at]mywebsite.com";

  
// Check the email address
  
$replace_str = array ("&"">""<""©""&nbsp;",
         
""", "®", "«", "»",
         "
¡", "¿", "À", "à",
         "
Á", "á", "Â", "â",
         "
Ã", "ã", "Ä", "ä",
         "
Å", "å", "Æ", "æ",
         "
Ç", "ç", "Ð", "ð", "È",
         "
è", "É", "é", "Ê",
         "
ê", "Ë", "ë", "Ì", "ì",
         "
Í", "í", "Î", "î",
         "
Ï", "ï", "Ñ", "ñ",
         "
Ò", "ò", "Ó", "ó",
         "
Ô", "ô", "Õ", "õ",
         "
Ö", "ö", "Ø", "ø",
         "
Ù", "ù", "Ú", "ú",
         "
Û", "û", "Ü", "ü", "Ý",
         "
ý", "ÿ", "Þ", "þ", "ß",
         "
§", "", "µ", "¦", "±",
         "
·", "¨", "¸", "ª", "º",
         "
¬", "*", "¯", "°", "¹",
         "
²", "³", "¼", "½",
         "
¾", "×", "¢", "£",
         "
¤", "¥", "http://", "ftp://", "mail://",
         
"news://""nntp://""irc://""gopher://",
         
","";"":""!""#""\$""%""\^""&""\*",
         
"\(""\)""\+""=""\{""\}""\[""]""\|""'"'"',
         
"/""\?"">""<""~""`"" ""¡""¢""£""¤",
         
"¥""¦""§""¨""©""ª""«""¬""*""®""¯",
         
"°""±""²""³""´""µ""¶""·""¸""¹""º",
         
"»""¼""½""¾""¿""À""Á""Â""Ã""Ä""Å",
         
"Æ""Ç""È""É""Ê""Ë""Ì""Í""Î""Ï""Ð",
         
"Ñ""Ò""Ó""Ô""Õ""Ö""×""Ø""Ù""Ú""Û",
         
"Ü""Ý""Þ""ß""à""á""â""ã""ä""å""æ",
         
"ç""è""é""ê""ë""ì""í""î""ï""ð""ñ",
         
"ò""ó""ô""õ""ö""÷""ø""ù""ú""û""ü",
         
"ý""þ""ÿ");

  
//check customer email address
  
for ($i 0$i sizeof ($replace_str) - 1$i++)
    
$tomail ereg_replace ($replace_str[$i], ""$tomail);
  
$pattern '^([._a-zA-Z0-9-]){2,255}[at]([._a-zA-Z0-9-]){2,255}\.([a-zA-Z]){2,3}$';

  if (!
ereg ($pattern$tomail) && !empty($tomail))
  {
      
$errorMessage .= "Your Friend's Email Address is not valid<BR>\n";
  }

    if (!empty(
$_POST["sender_email"]))
    {
      
$from "From: " $your_email "\nContent-type: text/html\n";
    } else {
      
$from "From: contact[at]mywebsite.com\nContent-type: text/html\n";
      
$your_email "contact[at]mywebsite.com";
  }

  
//if a field wasnt filled out calls an error page.
  //if (!empty($errorMessage))
  //{
  //  PrintError($errorMessage,"refer");
  //  exit;
  //}

$notifyMail "contact[at]mywebsite.com";
$notifySubject "TV Webcasts Was Shared from mywebsite.com";
$notifyMessage "The send video script was just used for:\r\n\r\n";
$notifyMessage .= "Live Streaming TV Webcasts\r\n";
$notifyMessage .= "h t t p:// w w w.mywebsite.com/live-webcasts/\r\n\r\n";
$notifyMessage .= "Recipient Email: " $tomail "\r\n\r\n";
$notifyMessage .= "Sender: " $_POST["sender_name"] . "\r\n";
$notifyMessage .= "Sender Email: " $_POST["sender_email"] . "\r\n";
$notifyMessage .= "Message: " $_POST["extra"] . "\r\n\r\n\r\n";
$notifyMessage .= "* Complete strangers are promoting mywebsite.com.";

  
//copy to sender
$copyfrom "From: " $_POST["sender_email"] . "";
$copyMail $_POST["sender_email"];
$copySubject "You sent TV webcasts from mywebsite.com";
$copyMessage "This is a copy of the email you sent to:\r\n";
$copyMessage .= $_POST["friend_email"] . "\r\n\r\n";
$copyMessage .= "When you have a moment, check out these online TV webcasts.\r\n\r\n";
$copyMessage .= "Live Streaming TV Webcasts\r\n\r\n";
$copyMessage .= "h t t p:// w w w.mywebsite.com/live-webcasts/\r\n\r\n\r\n";
$copyMessage .= $_POST["extra"] . "\r\n\r\n\r\n";
$copyMessage .= $_POST["sender_name"] . "\r\n\r\n\r\n\r\n";
$copyMessage .= "________________________________________\r\n";
$copyMessage .= "Sent courtesy of: h t t p:// w w w.mywebsite.com/\r\n\r\n";
//end of copy email

  //main message
$from "From: " $_POST["sender_email"] . "";
$subject "Check out these online TV webcasts...";

//email format - plain jane text
$inputMessage .= "Hi,\r\n\r\n";
$inputMessage .= "When you have a moment, check out these online TV webcasts.\r\n\r\n";
$inputMessage .= "Live Streaming TV Webcasts\r\n\r\n";
$inputMessage .= "h t t p:// w w w.mywebsite.com/live-webcasts/\r\n\r\n\r\n";
$inputMessage .= $_POST["extra"] . "\r\n\r\n\r\n";
$inputMessage .= $_POST["sender_name"] . "\r\n\r\n\r\n\r\n";
$inputMessage .= "________________________________________\r\n";
$inputMessage .= "Sent courtesy of: h t t p:// w w w.mywebsite.com/\r\n\r\n";
//end of email

  //send the email
  
mail ($tomail$subject$inputMessage,$from);
  
//mail ($notifyMail, $notifySubject, $notifyMessage);
  
if ($_POST["copyMail"]) {
      
mail ($copyMail$copySubject$copyMessage$copyfrom);
    }
  
ereg_replace(array("\n","\r"),'',$from)
  
//sends them off to the thank you page below
?>
<html>
<head>
<title>thank you page</title>

</head>
<body>
thank you page text
</body>
</html>

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > Need "else if" Statement For PHP Script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway