bobmcjob Posted November 12, 2008 Share Posted November 12, 2008 Hi! i'm new on here and relativley new to php. the problem i am faced with is i have a web page where people will select any number of checkboxes from 1-11 (more than one is allowed) and for each checkbox that is checked a pre-built html email brochure will be sent related to the selected checkbox. So there could be a minimum of none, with a maximum of 11 if they were to select all check boxes. Currently i have a php script that passes the checkboxes from one page to another with the values of either "on" or "" (nothing). I need a script that pretty much says if deal1 == 'on' send deal1 email else nothing. I need this to cycle through 11 times. If anyone can steer me in the right direction, show me an example of something similar that someone else has done, or provide any advice what so ever it would be very much appreciated. Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/132381-send-multiple-pre-built-html-emails/ Share on other sites More sharing options...
sKunKbad Posted November 12, 2008 Share Posted November 12, 2008 $email = array('deal1','deal2','deal3') foreach ($email as $html_email){ if ($html_email == 'on'){ mail( $to, $subject, $message, $headers ); } } Quote Link to comment https://forums.phpfreaks.com/topic/132381-send-multiple-pre-built-html-emails/#findComment-688274 Share on other sites More sharing options...
bobmcjob Posted November 12, 2008 Author Share Posted November 12, 2008 Cheers thats a start, How do i pull in the prebuilt emails that will be sitting in a folder i.e. emails/deal1.html etc. Sorry when i say im new to PHP i mean really new. Once again any help is much appreciated cheers! Quote Link to comment https://forums.phpfreaks.com/topic/132381-send-multiple-pre-built-html-emails/#findComment-688872 Share on other sites More sharing options...
sKunKbad Posted November 14, 2008 Share Posted November 14, 2008 Well, if it was me, I'd keep the prebuilt emails in a mysql database. If you have the subject line in one column, the message in another column, and headers in another column, all you would have to do is query the database for the specific emails you wish to send, and then loop through the rows, sending email as you go. Doing this would also give you the chance to have a non-html column, because usually when you send html email, you will want to send a text version also. If you will start putting together some code, and make a database, then when you get stuck we can help you. PHP is not like HTML, where you can easily copy and paste code and it will just work. You will need to learn. www.w3schools.com is a good place to learn, but the best stuff comes from books. I like the O'rielly book called "Programming PHP". Quote Link to comment https://forums.phpfreaks.com/topic/132381-send-multiple-pre-built-html-emails/#findComment-690484 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.