johnnys2 Posted August 7, 2013 Share Posted August 7, 2013 Hi Guys, Newbie here, I have a working admin system built and just finishing a few things off. I have a form with a few input fields (make, model, name) and one tick box 'Do you need assistance?'. Once submitted, this form successfully sends the info via email to manager@something.com. However, when the tick box mentioned above is ticked, Id like it to ALSO send a different email to assistance@something.com Code below; if(sendQf22Email($make, $model, $name,)){ $boolMailSent = true; }else{ $boolMailSent = false; } echo "<h1>Request Submitted</h1> <p>Your request has been submitted and is queued for processing.</p> <p>We will contact you once completed.</p> "; Basically the secondary email should go to an 'Assistance' team. However the main email should always go to the Manager. The second email would say something like 'Dear assistance team, please see form below as assistance has been requested......' Is this possible? Apologies if this sounds confusing. And thanks in advance. J Quote Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/ Share on other sites More sharing options...
TOA Posted August 7, 2013 Share Posted August 7, 2013 (edited) From the manual user@example.com, anotheruser@example.com Just add a conditional that only adds it if your box is ticked. *Edit - after reading the whole post again () you'll need to just make a second mail call to use a different message, but the conditional part would remain the same - if it's ticked, run a second call to mail(). Edited August 7, 2013 by TOA Quote Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443842 Share on other sites More sharing options...
johnnys2 Posted August 7, 2013 Author Share Posted August 7, 2013 thanks for the reply TOA, but would this not just send the exact same email to another recipient? I'd like it to send a different email, to a different recipient. Quote Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443844 Share on other sites More sharing options...
TOA Posted August 7, 2013 Share Posted August 7, 2013 thanks for the reply TOA, but would this not just send the exact same email to another recipient? I'd like it to send a different email, to a different recipient. Yep, edited my answer as you were typing Quote Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443845 Share on other sites More sharing options...
johnnys2 Posted August 7, 2013 Author Share Posted August 7, 2013 lol thanks very much, I'll go have a look at conditional mail calls Quote Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443847 Share on other sites More sharing options...
Solution TOA Posted August 7, 2013 Solution Share Posted August 7, 2013 // here's your normal mail call to manager mail($manager_email, $manager_message); // here's your conditional call if (isset($_POST['checkbox_name'])) { mail($assistance_email, $assistance_message); } You just need to see if the checkbox is checked and if it is send another email. That's what I meant. Sorry, I'm having a hard time being clear today Quote Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443850 Share on other sites More sharing options...
johnnys2 Posted August 8, 2013 Author Share Posted August 8, 2013 Thanks for this help TOA, how do I check if the checkbox is checked exactly? The code I have now is as follows // conditional call if (isset($_POST["assistance_reqd_for_setup"])) { $mail2($GLOBALS["MyEmail"], $HTMLmessage2); } assistance_reqd_for_setup - is the name of the checkbox MyEmail - is my email address saved in a global config file HTMLmessage2 - is the separate email that I'd like to send Quote Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1443963 Share on other sites More sharing options...
johnnys2 Posted August 8, 2013 Author Share Posted August 8, 2013 sorted! Quote Link to comment https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/#findComment-1444012 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.