Re: Send_mail function
| From: | Robin Vickery | Date: | Fri, 11 Aug 2000 15:42:53 +0000 |
| Subject: | Re: Send_mail function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11346@lists.php.net to get a copy of this message | ||
david@datajo.no ("David Tandberg-Johansen") writes:
> Hallo All!!
>
> I am trying to send a mail to an different mail acount based on which
> variable $chr has, but it seems to only go strait to the last ELSE and
> print.
>
> Could anyone please give me som feedback,....Thank's
>
> function send_mail()
> {
> if ($chr == "A")
> {
> send_to_me();
> }
> elseif ($chr == "B|C|D")
> {
> send_to_you();
> }
> else
> {
> print("The are no characters to report");
> }
> }
Use a switch statement:
function send_mail()
{
switch ($chr)
{
case 'A': send_to_me(); break;
case 'B':
case 'C':
case 'D': send_to_you(); break;
default : print "There are no characters to report";
}
}
--
Robin Vickery...............................................
Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK
Email: robin@planet-three.net Phone: +44 (0)794 670 6395