I forgot to mention that I want the email addresses to be appear on the webpage from a 
mySQL database.  I already have the emails entered into a database, and I have written 
the page that grabs each email from the database and puts it into a form with the 
Checkbox.  My problem is figuring out how to write the script to email these dynamic 
addresses.  I don't want to hard-code them into the web page.  If you need an example 
or the website, then I can send it to you so you can see.

        -----Original Message----- 
        From: Andrew Whyte [mailto:[EMAIL PROTECTED] 
        Sent: Thu 10/9/2003 10:38 PM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: RE: [PHP] email certain people
        
        



        > -----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