> -----Original Message-----
> From: Davy Campano [mailto:[EMAIL PROTECTED] 
> 
> I am making a webpage, and I want to be able to email certain 
> people that are selected by a checkbox when I click the 
> submit button.  I am trying to figure out what the best way 
> is to do this.  There are four people on the page and they 
> each start with their name checked (so they should receive an 
> email when I click submit).  How would I go writing a script 
> to check if these "checkboxes" are marked and then emailing 
> each person???  Thanks for any help!


Davy,

Something along the lines of:

Your form items would be:

<INPUT TYPE="CHECKBOX" NAME="EMAIL[]" VALUE="[EMAIL PROTECTED]"> user1 @
email.com <BR> 
<INPUT TYPE="CHECKBOX" NAME="EMAIL[]" VALUE="[EMAIL PROTECTED]"> user2 @
email.com <BR>
<INPUT TYPE="CHECKBOX" NAME="EMAIL[]" VALUE="[EMAIL PROTECTED]"> user3 @
email.com <BR>

Then in PHP this get posted to, something like:

if ( is_array($_POST["EMAIL"]) )
{
        // Loop through each...
        foreach ($_POST["EMAIL"] as $key => $email_addr )
        {
                // send your email to each user...
        }
}

This way you can simply add more email input fields to the form over
time
and the code will always work with it...

I'll leave the email sending as an exercise for the reader, there are
ample
good examples on php.net's doco about this.

Cheers, Andrew

--
Andrew Whyte                        Ph: +61 7 4930 9838
Corporate Systems Administrator     Fx: +61 7 4930 9254
Information Technology Division     Em: [EMAIL PROTECTED]
Central Queensland University, Rockhampton, Qld, 4702 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to