Re: For/Next Help Needed
| From: | mcp6453 | Date: | Mon, 05 Jul 2004 03:31:15 +0000 |
| Subject: | Re: For/Next Help Needed | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189682@lists.php.net to get a copy of this message | ||
John W. Holmes wrote:
>
> mcp6453 wrote:
>
> > I'm using Jack's PHP FormMail script, and I need to change it. I know
> > very little abou PHP, but here's what I very much need to do right away.
> >
> > I need the script to send the same hard coded message to each of 10
> > people. All of the email addresses do not need to be in the "To" field.
> > Only the intended recipient needs to be there.
> >
> > So, I see the code as something line this:
> >
> > $recipient[1] = "JaneSmith@janesmith.com";
> > $recipient[2] = "JaneDoe@JaneDoe.com";
> > ...
> > $recipient[n] = "JohnDoe@JohnDoe.com";
> >
> > Then, something like this:
> >
> > for ($z=0;$z<count($val);$z++)
> > mail($recipient[z$], $subject, $message, $headers);
>
> for($z=0;$z<count($recipient);$z++)
> { mail($recipient[$z],$subject,$message,$headers); }
Thanks, John. That's helpful. I'm not sure what other problems I'm going
to run into. It looks like I may have to put the whole script inside the
"for" loop.
What is the difference between this code and using a "foreach" command?