Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.32 KB | None | 0 0
  1. <form method="post" id="formApply" action="<?php bloginfo('template_url');?>/inc/sendContact.php" name="applyForm">
  2. <div id="col1">
  3. <fieldset class="col-1">
  4. <div class="white info-line">Want to know more? Drop us a line and we'll get right back to you.</div>
  5. <label class="white text-label name" for="fname">Name:</label><input type="text" name="fname" id="fname" tabindex="1" />
  6. <div class="clear"></div>
  7. <label class="white text-label email" for="email">Email:</label><input type="email" class="lower" name="email" id="email" tabindex="2"/>
  8. <div class="clear"></div>
  9. <label class="white text-label phone" for="phone">Phone:</label><input type="tel" name="phone" id="phone" tabindex="3" maxlength="10"/>
  10. <div class="white text-label checker-title" id="checkererror">I am interested in:</div>
  11. <input type="checkbox" id="checkbox-2-1" class="regular-checkbox big-checkbox" name="checker[]" value="Office Space" /><label for="checkbox-2-1"></label><div class="white text-label checker">Office Space</div>
  12. <input type="checkbox" id="checkbox-2-2" class="regular-checkbox big-checkbox" name="checker[]" value="Designated Workspace" /><label for="checkbox-2-2"></label><div class="white text-label checker">Designated Workspace</div>
  13. <input type="checkbox" id="checkbox-2-3" class="regular-checkbox big-checkbox" name="checker[]" value="Shared Space" /><label for="checkbox-2-3"></label><div class="white text-label checker">Shared Space</div>
  14. </fieldset>
  15. </div>
  16. <div id="col2">
  17. <fieldset class="col-2">
  18. <label class="white text-label note-label" for="notes">Notes:</label><br/>
  19. <textarea name="notes" id="notes" rows="10" cols="30" class="requiredField" tabindex="4"></textarea>
  20. <input type="hidden" name="submitted" id="submitted" class="submitted" value="true" /><button id="submit" type="submit">Submit Application</button>
  21. </fieldset>
  22. </div>
  23. </form>
  24.  
  25. require_once 'lib/swift_required.php';
  26.  
  27.  
  28. $transport = Swift_MailTransport::newInstance();
  29.  
  30. $mailer = Swift_Mailer::newInstance($transport);
  31.  
  32. $name = Trim(stripslashes($_POST['fname']));
  33. $email = Trim(stripslashes($_POST['email']));
  34. $phone = Trim(stripslashes($_POST['phone']));
  35. $notes = Trim(stripslashes($_POST['notes']));
  36. $checkbox = $_POST['checker'];
  37.  
  38.  
  39. $message = Swift_Message::newInstance()
  40. ->setFrom(array('From_Email' => 'My Website'))
  41. ->setSubject('[My_Subject from '.$name.']')
  42. ->setTo(array('My_Email'))
  43. ->setBody(
  44. '<html>'.
  45. '<head></head>'.
  46. '<body>'.
  47. '<strong>Name:</strong><br />'.
  48. $title.' '.$name.'<br /><br />'.
  49. '<strong>Email Address:</strong><br />'.
  50. $email.'<br /><br />'.
  51. '<strong>Phone Number:</strong><br />'.
  52. $phone.'<br /><br />'.
  53. '<strong>Interested in:</strong><br />'.
  54. implode('<br />', $checkbox).'<br /><br />'.
  55. '<strong>Message:</strong><br />'.
  56. $notes.'<br /><br />'.
  57. '</body>'.
  58. '</html>',
  59. 'text/html' );
  60. $result = $mailer->send($message);
  61.  
  62. jQuery(document).ready(function() {
  63. jQuery("#submit").click(function(){
  64. jQuery.ajax({
  65. type: 'POST',
  66. url: '<?php echo admin_url('admin-ajax.php');?>',
  67. data: {
  68. action: 'MyAjaxCallBack',
  69. MyParam: 'MyParamValue'
  70. },
  71. success: function(data, textStatus, XMLHttpRequest){
  72. alert(data);
  73. },
  74. error: function(MLHttpRequest, textStatus, errorThrown){
  75. alert(errorThrown);
  76. }
  77. });
  78. });
  79.  
  80. function MyAjaxCallBack()
  81. {
  82. foreach($_POST as $key=>$value)
  83. $$key = $value;
  84.  
  85. die('Email script will go here!');
  86. }
  87.  
  88. // creating Ajax call for WordPress
  89. add_action('wp_ajax_nopriv_MyAjaxCallBack', 'MyAjaxCallBack');
  90. add_action('wp_ajax_MyAjaxCallBack', 'MyAjaxCallBack');
  91.  
  92. <form method="post" id="formApply" action="<?php bloginfo('template_url');?>/inc/sendContact.php" name="applyForm">
  93. <div id="col1">
  94. <fieldset class="col-1">
  95. <div class="white info-line">Want to know more? Drop us a line and we'll get right back to you.</div>
  96. <label class="white text-label name" for="fname">Name:</label><input type="text" name="fname" id="fname" tabindex="1" />
  97. <div class="clear"></div>
  98. <label class="white text-label email" for="email">Email:</label><input type="email" class="lower" name="email" id="email" tabindex="2"/>
  99. <div class="clear"></div>
  100. <label class="white text-label phone" for="phone">Phone:</label><input type="tel" name="phone" id="phone" tabindex="3" maxlength="10"/>
  101. <div class="white text-label checker-title" id="checkererror">I am interested in:</div>
  102. <input type="checkbox" id="checkbox-2-1" class="regular-checkbox big-checkbox" name="checker[]" value="Office Space" /><label for="checkbox-2-1"></label><div class="white text-label checker">Office Space</div>
  103. <input type="checkbox" id="checkbox-2-2" class="regular-checkbox big-checkbox" name="checker[]" value="Designated Workspace" /><label for="checkbox-2-2"></label><div class="white text-label checker">Designated Workspace</div>
  104. <input type="checkbox" id="checkbox-2-3" class="regular-checkbox big-checkbox" name="checker[]" value="Shared Space" /><label for="checkbox-2-3"></label><div class="white text-label checker">Shared Space</div>
  105. </fieldset>
  106. </div>
  107. <div id="col2">
  108. <fieldset class="col-2">
  109. <label class="white text-label note-label" for="notes">Notes:</label><br/>
  110. <textarea name="notes" id="notes" rows="10" cols="30" class="requiredField" tabindex="4"></textarea>
  111. <input type="hidden" name="submitted" id="submitted" class="submitted" value="true" /><button id="submit" type="submit">Submit Application</button>
  112. </fieldset>
  113. </div>
  114. </form>
  115.  
  116. require( '../../../../wp-blog-header.php' );
  117. require_once 'lib/swift_required.php';
  118.  
  119.  
  120. $transport = Swift_MailTransport::newInstance();
  121.  
  122. $mailer = Swift_Mailer::newInstance($transport);
  123.  
  124. $name = Trim(stripslashes($_POST['fname']));
  125. $email = Trim(stripslashes($_POST['email']));
  126. $phone = Trim(stripslashes($_POST['phone']));
  127. $notes = Trim(stripslashes($_POST['notes']));
  128. $checkbox = $_POST['checker'];
  129. $adminEmail = get_bloginfo('admin_email');
  130.  
  131. $message = Swift_Message::newInstance()
  132. ->setFrom(array('From_Email' => 'My Website'))
  133. ->setSubject('[My_Subject from '.$name.']')
  134. ->setTo(($adminEmail))
  135. ->setBody(
  136. '<html>'.
  137. '<head></head>'.
  138. '<body>'.
  139. '<strong>Name:</strong><br />'.
  140. $title.' '.$name.'<br /><br />'.
  141. '<strong>Email Address:</strong><br />'.
  142. $email.'<br /><br />'.
  143. '<strong>Phone Number:</strong><br />'.
  144. $phone.'<br /><br />'.
  145. '<strong>Interested in:</strong><br />'.
  146. implode('<br />', $checkbox).'<br /><br />'.
  147. '<strong>Message:</strong><br />'.
  148. $notes.'<br /><br />'.
  149. '</body>'.
  150. '</html>',
  151. 'text/html' );
  152. $result = $mailer->send($message);
  153. $url = home_url('/#apply');
  154. die(header("Location: $url", true));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement