Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.05 KB | None | 0 0
  1. <h3 class="title-big wow fadeIn">Contact Us</h3>
  2. <br>
  3. </div>
  4. <div class="col-md-12 text-center">
  5. <?php if($success != ""): ?>
  6. <span class="col-md-4 col-md-offset-4" style="color:#D91E18"> <?php echo $success;?></span>
  7. <?php endif; ?>
  8. <div class="form-group col-md-offset-4 col-md-4 col-md-offset-4 wow fadeInDown">
  9. <form name="myform" role="form" action="sendmail" method="post">
  10. <div class="form-group">
  11. <?php echo form_input($first_name);?>
  12. </div>
  13.  
  14.  
  15. <div class="form-group">
  16. <?php echo form_input($email);?>
  17. </div>
  18.  
  19.  
  20. <div class="form-group">
  21. <?php echo form_textarea($message1);?>
  22. <br>
  23. <a class="sign-up-button btn btn-border btn-lg col-md-offset-3 col-md-6 col-md-offset-3 wow fadeInUp" data-wow-delay="1s" href="javascript: submitform()">Submit Query</a>
  24. </div>
  25. </form>
  26.  
  27. public function contact()
  28. {
  29. $data['success'] = (validation_errors() ? validation_errors() : ($this->session->flashdata('message')));
  30. //$data['message'] = (validation_errors() ? validation_errors() : ($this->session->flashdata('message')));
  31. $data['message1'] = array(
  32. 'name' => 'message1',
  33. 'id' => 'message1',
  34. 'class' => 'form-control',
  35. 'placeholder' => "Enter message here...",
  36. 'size' => 32,
  37. 'maxlength' => 500,
  38. 'rows' => 5,
  39. 'cols' => 41,
  40.  
  41. );
  42. $data['first_name'] = array(
  43. 'name' => 'first_name',
  44. 'id' => 'first_name',
  45. 'type' => 'text',
  46. 'class' => 'form-control',
  47. 'placeholder' => "First Name...",
  48. 'size' => 32,
  49. 'maxlength' => 50,
  50.  
  51. );
  52. $data['email'] = array(
  53. 'name' => 'email',
  54. 'id' => 'email',
  55. 'type' => 'text',
  56. 'class' => 'form-control',
  57. 'placeholder' => "Email Address (Mandatory)",
  58. 'size' => 32,
  59. 'maxlength' => 128,
  60.  
  61. );
  62.  
  63. $this->load->view('contact',$data);
  64. }
  65.  
  66. public function sendmail()
  67. {
  68. $this->form_validation->set_rules('first_name', 'Name', 'required');
  69. //$this->form_validation->set_rules('last_name', 'Name', 'required');
  70. $this->form_validation->set_rules('message1', 'Message', 'required');
  71. $this->form_validation->set_rules('email', 'Email Address', 'required');
  72. //$this->form_validation->set_rules('email_confirm', 'Reenter Email Address', 'required');
  73. if ($this->form_validation->run() == true)
  74. {
  75. $data = array(
  76. 'first_name' => $this->input->post('first_name'),
  77. //'last_name' => $this->input->post('last_name'),
  78. 'message1' => $this->input->post('message1'),
  79. 'email' => $this->input->post('email'),
  80. );
  81.  
  82. //if ($this->form_validation->run() == true)
  83. //{
  84.  
  85.  
  86. $config = array(
  87. 'protocol' => 'smtp',
  88. 'smtp_host' => 'ssl://smtp.gmail.com',
  89. 'smtp_port' => 465,
  90. 'auth' => true,
  91. 'smtp_user' => 'basharatdawood@gmail.com',
  92. 'smtp_pass' => 'usmanmera'
  93. );
  94. $emailsubject = $data['first_name']." ".$data['last_name']." has sent a Query message.";
  95.  
  96. $this->load->library('email',$config);
  97. $this->email->set_newline("rn");
  98. // $this->email->initialize($config);
  99.  
  100. $this->email->from('basharatdawood@gmail.com', 'AOTS Lahore Regional Center');
  101. //$this->email->to('baig.imran44@gmail.com');
  102. $this->email->to('dawoodbasharat04@gmail.com');
  103. $this->email->cc('dawoodbasharat04@gmail.com');
  104. $this->email->subject($emailsubject);
  105. $this->email->message($data['message1']."nEmail ID: ".$data['email']);
  106.  
  107. if ($this->email->send())
  108. {
  109. $data['success'] = "Your Query has been sent successfully... !!";
  110. //$data['message'] = (validation_errors() ? validation_errors() : ($this->session->flashdata('message')));
  111. $data['message1'] = array(
  112. 'name' => 'message1',
  113. 'id' => 'message1',
  114. 'class' => 'form-control',
  115. 'placeholder' => "Enter message here...",
  116. 'size' => 32,
  117. 'maxlength' => 500,
  118. 'rows' => 5,
  119. 'cols' => 41,
  120.  
  121. );
  122. $data['first_name'] = array(
  123. 'name' => 'first_name',
  124. 'id' => 'first_name',
  125. 'type' => 'text',
  126. 'class' => 'form-control',
  127. 'placeholder' => "First Name...",
  128. 'size' => 32,
  129. 'maxlength' => 50,
  130.  
  131. );
  132.  
  133. $data['email'] = array(
  134. 'name' => 'email',
  135. 'id' => 'email',
  136. 'type' => 'text',
  137. 'class' => 'form-control',
  138. 'placeholder' => "Email Address (Mandatory)",
  139. 'size' => 32,
  140. 'maxlength' => 128,
  141.  
  142. );
  143.  
  144. $this->load->view('contact',$data);
  145. }
  146. else
  147. {
  148. $data['success'] = show_error( $this->email->print_debugger());
  149. }
  150.  
  151. }
  152. //}
  153. else
  154. {
  155.  
  156. $data['success'] = (validation_errors() ? validation_errors() : ($this->session->flashdata('message')));
  157.  
  158.  
  159.  
  160. $data['message1'] = array(
  161. 'name' => 'message1',
  162. 'id' => 'message1',
  163. 'class' => 'form-control',
  164. 'placeholder' => "Enter message here...",
  165. 'size' => 32,
  166. 'maxlength' => 500,
  167. 'rows' => 5,
  168. 'cols' => 41,
  169.  
  170. );
  171. $data['first_name'] = array(
  172. 'name' => 'first_name',
  173. 'id' => 'first_name',
  174. 'type' => 'text',
  175. 'class' => 'form-control',
  176. 'placeholder' => "First Name...",
  177. 'size' => 32,
  178. 'maxlength' => 50,
  179.  
  180. );
  181. $data['email'] = array(
  182. 'name' => 'email',
  183. 'id' => 'email',
  184. 'type' => 'text',
  185. 'class' => 'form-control',
  186. 'placeholder' => "Email Address (Mandatory)",
  187. 'size' => 32,
  188. 'maxlength' => 128,
  189.  
  190. );
  191. $this->load->view('contact',$data);
  192. }
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement