Re: Multiple mails to be sent from checkbox selection
| From: | Dan Hardiker | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Multiple mails to be sent from checkbox selection | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95697@lists.php.net to get a copy of this message | ||
Hi,
> I am not sure how I should me sending the checkbox name and variables
> and then how to actually insert the email addresses using the mail
> command. Is there a better way than using a checkbox?
If you have a HTML form with a list of email addresses to send to you might
want the code to look something like:
<input type='checkbox' name='sendTo[]' value='user1@domain.com'
/> User
1<br />
<input type='checkbox' name='sendTo[]' value='user2@domain.com'
/> User
2<br />
<input type='checkbox' name='sendTo[]' value='user3@domain.com'
/> User
3<br />
Now in the resulting PHP code (assuming that you're using >= PHP v4.1.x and
using METHOD="get" in the form) you should find $_GET['sendTo'] is an array
of email addresses they ticked. Just add them as mail headers (you can find
simple instructions on the http://www.php.net/mail page in the
user
comments).
If METHOD="post" then use $_POST, and if an old version of PHP is being
used then use $HTTP_POST_VARS / $HTTP_GET_VARS.
--
Dan Hardiker [dhardiker@staff.firstcreative.net]
ADAM Software & Systems Engineer
First Creative Ltd