php - Codeigniter Contact form submit returning timeout -


hi wondering if give me insight why codeigniter contact form times out on submit?

i understand beginner error feel overlooking. have provided controller , view.

i have email.php setup in config file well, various helpers , libraries loaded. thank in advance!

controller

<?php class contactform extends ci_controller {     public function __construct()     {         parent::__construct();         $this->load->helper(array('form','url'));         $this->load->library(array('session', 'form_validation', 'email'));     }      function index()     {         //set validation rules         $this->form_validation->set_rules('name', 'name', 'trim|required|xss_clean|callback_alpha_space_only');         $this->form_validation->set_rules('email', 'emaid id', 'trim|required|valid_email');         $this->form_validation->set_rules('subject', 'subject', 'trim|required|xss_clean');         $this->form_validation->set_rules('message', 'message', 'trim|required|xss_clean');          //run validation on form input         if ($this->form_validation->run() == false) {             //validation fails             $this->load->view('contact_form_view');         } else {             //get form data             $name       = $this->input->post('name');             $from_email = $this->input->post('email');             $subject    = $this->input->post('subject');             $message    = $this->input->post('message');              //set to_email id receive emails             $to_email = 'littleliongirldesigns@gmail.com';              //configure email settings             $config['protocol']  = 'smtp';             $config['smtp_host'] = 'ssl://smtp.gmail.com';             $config['smtp_port'] = '465';             $config['smtp_user'] = 'email';             $config['smtp_pass'] = 'password';             $config['mailtype']  = 'html';             $config['charset']   = 'iso-8859-1';             $config['wordwrap']  = true;             $config['newline']   = "\r\n"; //use double quotes             $this->load->library('email', $config);             $this->email->initialize($config);                                      //send mail             $this->email->from($from_email, $name);             $this->email->to($to_email);             $this->email->subject($subject);             $this->email->message($message);              if ($this->email->send()) {                 // mail sent                 $this->session->set_flashdata('msg','<div class="alert alert-success text-center">your mail has been sent successfully!</div>');                 redirect('contactform/index');             } else {                 //error                 $this->session->set_flashdata('msg','<div class="alert alert-danger text-center">there error in sending mail! please try again later</div>');                 redirect('contactform/index');             }         }     }      //custom validation function accept alphabets , space input     function alpha_space_only($str)     {         if (!preg_match("/^[a-za-z ]+$/",$str)) {             $this->form_validation->set_message('alpha_space_only', 'the %s field must contain alphabets , space');             return false;         } else {             return true;         }     } } ?> 

view

    <div class="container">     <div class="row">         <div class="col-md-6 col-md-offset-3 well">             <?php $attributes = array("class" => "form-horizontal", "name" => "contactform");             echo form_open("contactform/index", $attributes);?>             <fieldset>             <legend>contact form</legend>             <div class="form-group">                 <div class="col-md-12">                     <label for="name" class="control-label">name</label>                 </div>                 <div class="col-md-12">                     <input class="form-control" name"name" placeholder="your name" type="text" value="<?php echo set_value('name'); ?>"/>                     <span class="text-danger"><?php echo form_error('name'); ?></span>                 </div>                 </div>             <div class="form-group">                 <div class="col-md-12">                 <label for="email" class="control-label">email id</label>                 </div>                 <div class="col-md-12">                 <input class="form-control" name="email" placeholder="your email" type="text" value="<?php echo set_value('email'); ?>" />                     <span class="text-danger"><?php echo form_error('email');?></span>                 </div>                         </div>             <div class="form-group">                 <div class="col-md-12">                     <label for="subject" class="control-label">subject</label>                     </div>                 <div class="col-md-12">                     <input class="form-control" name="subject" placeholder="subject" type="text" value="<?php echo set_value('subject'); ?>"/>                     <span class="text-danger"><?php echo form_error('subject');?></span>                     </div>                 </div>                 <div class="form-group">                     <div class="col-md-12">                     <label for="message" class="control-label">message</label>                     </div>                     <div class="col-md-12">                     <textarea class="form-control" name="message" rows="4" placeholder="your message"><?php echo set_value('message');?></textarea>                     <span class="text-danger"><?php echo form_error('message'); ?></span>                     </div>                             </div>                  <div class="form-group">                     <div class="col-md-12">                     <input name="submit" type="submit" class="btn btn-primary"  value="send" />                     </div>                 </div>             </fieldset>             <?php echo form_close(); ?>             <?php echo $this->session->flashdata('msg'); ?>             </div>         </div>     </div> 


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -