Quoting Aaron Wolski <[EMAIL PROTECTED]>: > Hi, > > Ok I understand your code... > > > How about I error check to ensure that if any of the name/email pairs > don't have a value to discount their entry? > > For example... > > If the user enters: > > Aaron [EMAIL PROTECTED] > Rob <blank> > Bob [EMAIL PROTECTED] > <blank> [EMAIL PROTECTED] > > > How would I disregard the 2nd and 4th pairs? > > Sorry for bugging. > > Aaron
For validating that any string conforms to some expected pattern.... This will be alot to swallow but it's what you want, glance through the user added comments, maybe the email validation one is already there. http://www.php.net/manual/en/function.preg-match.php or http://www.php.net/manual/en/function.ereg-match.php If you need help, post a new topic in php-general for this one, you'll get plenty of responses for regex help. ;-) I hope you don't "understand" the first email, I sent it on accident before completion. That was the why you received two. --Ryan > -----Original Message----- > From: Ryan Gallagher [mailto:[EMAIL PROTECTED]] > Sent: November 20, 2002 2:09 PM > To: Aaron Wolski > Subject: Re: [PHP-DB] multiple foreach loop? > > Quoting Aaron Wolski <[EMAIL PROTECTED]>: > > > Hi All, > > > > Trying to create a "refer a friend" script. > > > > User enters 10 names and email address of a friend to refer to a site. > > > > The following code SORT of works in that it will send the email, etc.. > > but problem is it duplicates - sends the email out twice to the same > > email address. > > > > **CODE*** > > > > foreach($nameRefered as $referedName) { > > > > foreach($emailRefered as $referedEmail) { > > > > if ($referedEmail != "" && $referedName != "") > { > > > > <message body here> > > > > /* To send HTML mail, you can set > > the Content-type header. */ > > $headers = "Return-Path: > > <$support_email>\r\n"; > > $headers .= "MIME-Version: > 1.0\r\n"; > > > > $headers .= "Content-type: > > text/html; charset=iso-8859-1\r\n"; > > $headers .= "From: $nameReferer > > <".$emailReferer.">\r\n"; > > > > mail ($referedEmail,"Your Order on > > Rinkrake.com", $message, $headers); > > > > } > > } > > } > > > > Any thoughts on why I get the email twice? > > > > Thanks all. Much appreciated! > > > > Aaron -- Ryan T. Gallagher [EMAIL PROTECTED] International Studies Abroad http://www.studiesabroad.com (512)480-8522 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php