Posted By

stephcode on 05/14/11


Tagged

email dropdown FormMail tectite


Versions (?)

Tectite formmail email recipient split depending on dropdown selection


 / Published in: PHP
 

  1. formmail.php:
  2.  
  3. if ($bUseOldVars)
  4. {
  5. $aServerVars = &$HTTP_SERVER_VARS;
  6. $aGetVars = &$HTTP_GET_VARS;
  7. $aFormVars = &$HTTP_POST_VARS;
  8. $aFileVars = &$HTTP_POST_FILES;
  9. $aEnvVars = &$HTTP_ENV_VARS;
  10. }
  11. else
  12. {
  13. $aServerVars = &$_SERVER;
  14. $aGetVars = &$_GET;
  15.  
  16. $sSelection = $_POST['recipients'];
  17. $aEmails = array(
  18. 'Restaurant1' => "[email protected]",
  19. 'Restaurant2' => "[email protected]");
  20.  
  21. $_POST['recipients'] = $aEmails[ $sSelection ];
  22.  
  23. $aFormVars = &$_POST;
  24. $aFileVars = &$_FILES;
  25. $aEnvVars = &$_ENV;
  26. }
  27.  
  28. HTML:
  29.  
  30. <form method="post" action="formmail.php" name="theForm">
  31. <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">
  32. <input type="hidden" name="good_url" value="thank-you.php" />
  33. <input type="hidden" name="subject" value="Restaurant Reservations" />
  34. <input type="hidden" name="mail_options" value="PlainTemplate=reservations.txt,AlwaysList" />
  35. <div class="form-contact-wrapper">
  36.  
  37. <div class="row-wrapper">
  38. <div class="label-container"><p class="label">Name<span class="req">*</span></p></div>
  39. <div class="field-container"><input type="text" name="Name" class="field" /></div>
  40. </div>
  41.  
  42. <div class="row-wrapper">
  43. <div class="label-container"><p class="label">Restaurant</p></div>
  44. <div class="field-container">
  45.  
  46. <select name="recipients" class="field form-dropdown">
  47. <option value="Unselected" selected>-- Please Choose One --</option>
  48. <option value="Restaurant1">Restaurant1</option>
  49. <option value="Restaurant2">Restaurant2</option>
  50. </select>
  51.  
  52. </div>
  53. </div>
  54.  
  55. <div class="row-wrapper">
  56. <div class="form-sublabel-container"><p class="form-sublabel">* Required</p></div>
  57. <div class="form-submit-container"><input type="submit" class="form-submit3" name="Submit" value="" /></div>
  58. </div>
  59. </div>
  60. </form>

Report this snippet  

You need to login to post a comment.