Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h3 class="title-big wow fadeIn">Contact Us</h3>
- <br>
- </div>
- <div class="col-md-12 text-center">
- <?php if($success != ""): ?>
- <span class="col-md-4 col-md-offset-4" style="color:#D91E18"> <?php echo $success;?></span>
- <?php endif; ?>
- <div class="form-group col-md-offset-4 col-md-4 col-md-offset-4 wow fadeInDown">
- <form name="myform" role="form" action="sendmail" method="post">
- <div class="form-group">
- <?php echo form_input($first_name);?>
- </div>
- <div class="form-group">
- <?php echo form_input($email);?>
- </div>
- <div class="form-group">
- <?php echo form_textarea($message1);?>
- <br>
- <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>
- </div>
- </form>
- public function contact()
- {
- $data['success'] = (validation_errors() ? validation_errors() : ($this->session->flashdata('message')));
- //$data['message'] = (validation_errors() ? validation_errors() : ($this->session->flashdata('message')));
- $data['message1'] = array(
- 'name' => 'message1',
- 'id' => 'message1',
- 'class' => 'form-control',
- 'placeholder' => "Enter message here...",
- 'size' => 32,
- 'maxlength' => 500,
- 'rows' => 5,
- 'cols' => 41,
- );
- $data['first_name'] = array(
- 'name' => 'first_name',
- 'id' => 'first_name',
- 'type' => 'text',
- 'class' => 'form-control',
- 'placeholder' => "First Name...",
- 'size' => 32,
- 'maxlength' => 50,
- );
- $data['email'] = array(
- 'name' => 'email',
- 'id' => 'email',
- 'type' => 'text',
- 'class' => 'form-control',
- 'placeholder' => "Email Address (Mandatory)",
- 'size' => 32,
- 'maxlength' => 128,
- );
- $this->load->view('contact',$data);
- }
- public function sendmail()
- {
- $this->form_validation->set_rules('first_name', 'Name', 'required');
- //$this->form_validation->set_rules('last_name', 'Name', 'required');
- $this->form_validation->set_rules('message1', 'Message', 'required');
- $this->form_validation->set_rules('email', 'Email Address', 'required');
- //$this->form_validation->set_rules('email_confirm', 'Reenter Email Address', 'required');
- if ($this->form_validation->run() == true)
- {
- $data = array(
- 'first_name' => $this->input->post('first_name'),
- //'last_name' => $this->input->post('last_name'),
- 'message1' => $this->input->post('message1'),
- 'email' => $this->input->post('email'),
- );
- //if ($this->form_validation->run() == true)
- //{
- $config = array(
- 'protocol' => 'smtp',
- 'smtp_host' => 'ssl://smtp.gmail.com',
- 'smtp_port' => 465,
- 'auth' => true,
- 'smtp_user' => 'basharatdawood@gmail.com',
- 'smtp_pass' => 'usmanmera'
- );
- $emailsubject = $data['first_name']." ".$data['last_name']." has sent a Query message.";
- $this->load->library('email',$config);
- $this->email->set_newline("rn");
- // $this->email->initialize($config);
- $this->email->from('basharatdawood@gmail.com', 'AOTS Lahore Regional Center');
- //$this->email->to('baig.imran44@gmail.com');
- $this->email->to('dawoodbasharat04@gmail.com');
- $this->email->cc('dawoodbasharat04@gmail.com');
- $this->email->subject($emailsubject);
- $this->email->message($data['message1']."nEmail ID: ".$data['email']);
- if ($this->email->send())
- {
- $data['success'] = "Your Query has been sent successfully... !!";
- //$data['message'] = (validation_errors() ? validation_errors() : ($this->session->flashdata('message')));
- $data['message1'] = array(
- 'name' => 'message1',
- 'id' => 'message1',
- 'class' => 'form-control',
- 'placeholder' => "Enter message here...",
- 'size' => 32,
- 'maxlength' => 500,
- 'rows' => 5,
- 'cols' => 41,
- );
- $data['first_name'] = array(
- 'name' => 'first_name',
- 'id' => 'first_name',
- 'type' => 'text',
- 'class' => 'form-control',
- 'placeholder' => "First Name...",
- 'size' => 32,
- 'maxlength' => 50,
- );
- $data['email'] = array(
- 'name' => 'email',
- 'id' => 'email',
- 'type' => 'text',
- 'class' => 'form-control',
- 'placeholder' => "Email Address (Mandatory)",
- 'size' => 32,
- 'maxlength' => 128,
- );
- $this->load->view('contact',$data);
- }
- else
- {
- $data['success'] = show_error( $this->email->print_debugger());
- }
- }
- //}
- else
- {
- $data['success'] = (validation_errors() ? validation_errors() : ($this->session->flashdata('message')));
- $data['message1'] = array(
- 'name' => 'message1',
- 'id' => 'message1',
- 'class' => 'form-control',
- 'placeholder' => "Enter message here...",
- 'size' => 32,
- 'maxlength' => 500,
- 'rows' => 5,
- 'cols' => 41,
- );
- $data['first_name'] = array(
- 'name' => 'first_name',
- 'id' => 'first_name',
- 'type' => 'text',
- 'class' => 'form-control',
- 'placeholder' => "First Name...",
- 'size' => 32,
- 'maxlength' => 50,
- );
- $data['email'] = array(
- 'name' => 'email',
- 'id' => 'email',
- 'type' => 'text',
- 'class' => 'form-control',
- 'placeholder' => "Email Address (Mandatory)",
- 'size' => 32,
- 'maxlength' => 128,
- );
- $this->load->view('contact',$data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement