lukeawade Posted August 5, 2008 Share Posted August 5, 2008 I'm sure this is very simple but I have just started using PHP so am not sure how to accomplish what I want. I have a register page that when the submit button is clicked an email is sent to the email address i designate. Well in my form I have a drop down list(distribution method) and you can choose CD or download. Well i only want to recieve an email if the distribution method is CD. Also I am connecting to a database to keep track of this information and I'm using form validation. I'm not sure whether to add code to the SELECT STATEMENT <select name="distribution_method" id="distribution_method"> <option selected="selected" value="<?php echo $row_rsdashboard_registration['distribution_method']; ?>"><?php echo $row_rsdashboard_registration['distribution_method']; ?></option> <option value="CD">Install CD</option> <option value="Download">Electronic Download</option> </select> <?php echo $tNGs->displayFieldError("dashboard_registration", "distribution_method"); ?> OR THE TRIGGER I HAVE SENDING THE EMAIL //start Trigger_SendEmail trigger //remove this line if you want to edit the code by hand function Trigger_SendEmail(&$tNG) { $emailObj = new tNG_Email($tNG); $emailObj->setFrom("[email protected]"); $emailObj->setTo("{email}"); $emailObj->setCC(""); $emailObj->setBCC("[email protected]"); $emailObj->setSubject("Registration"); //WriteContent method $emailObj->setContent("{first_name}, <br><br> Thank you for registering<br><br> The Project Information Management Team <br><br><br><br> (Preferred Delivery Method: {distribution_method}) "); $emailObj->setEncoding("ISO-8859-1"); $emailObj->setFormat("HTML/Text"); $emailObj->setImportance("Normal"); return $emailObj->Execute(); } //end Trigger_SendEmail trigger EDITED BY akitchin: please use code tags for code. Link to comment https://forums.phpfreaks.com/topic/118338-im-sure-its-simple/ Share on other sites More sharing options...
troy_mccormick Posted August 5, 2008 Share Posted August 5, 2008 <?php if ($_POST['distribution_method'] != "CD") { // send email code here } ?> Link to comment https://forums.phpfreaks.com/topic/118338-im-sure-its-simple/#findComment-609034 Share on other sites More sharing options...
lukeawade Posted August 6, 2008 Author Share Posted August 6, 2008 != doesnt that mean if its NOT 'CD' send email? Link to comment https://forums.phpfreaks.com/topic/118338-im-sure-its-simple/#findComment-609653 Share on other sites More sharing options...
lukeawade Posted August 6, 2008 Author Share Posted August 6, 2008 Ok so now I'm having this problem. I am using a trigger to send the email. I still need to send the email to the person who registers but I only need to recieve an email if they need a cd. I tried putting the code you gave me to set the bcc to me if they choose CD but its not working. //start Trigger_SendEmail trigger //remove this line if you want to edit the code by hand function Trigger_SendEmail(&$tNG) { $emailObj = new tNG_Email($tNG); $emailObj->setFrom("[email protected]"); $emailObj->setTo("{email}"); $emailObj->setCC(""); if ($_POST['distribution_method'] != "CD") { $emailObj->setBCC("[email protected]"); } $emailObj->setSubject("Children's Mercy Hospital ED OR :: MySmartPlans Project Registration"); //WriteContent method $emailObj->setContent("{first_name}, <br><br> Thank you for registering If you chose to download the software installer, or if you would now like to download the installer before you receive your install CD, please follow the directions below. <br><br> Thank you, <br><br> The Project Information Management Team <br><br><br><br> (Preferred Delivery Method: {distribution_method}) "); $emailObj->setEncoding("ISO-8859-1"); $emailObj->setFormat("HTML/Text"); $emailObj->setImportance("Normal"); return $emailObj->Execute(); } //end Trigger_SendEmail trigger Link to comment https://forums.phpfreaks.com/topic/118338-im-sure-its-simple/#findComment-609678 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.