Jump to content

Single Form, Multiple Emails?


johnnys2

Recommended Posts

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 [email protected]. However, when the tick box mentioned above is ticked, Id like it to ALSO send a different email to [email protected]

 

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

 

Link to comment
https://forums.phpfreaks.com/topic/280922-single-form-multiple-emails/
Share on other sites

From the manual

 

 

 

Just add a conditional that only adds it if your box is ticked.

*Edit - after reading the whole post again (:P) 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().

// 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 :)

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
 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.