php - How to send contact form detail including userEmail on form through codeigniter on web-server not through local-host -


there lots of answer send mail though local-host contact form data , this. when website on server (hostinger) going stuck problem.

i want send data of contact form on email , contact form data on email user-email field data not comes in email , if i'm pass email field data on form, it's send email mail not comes in mail account , not show error, , on console show request post successfully.

if i'm comment user-email field data every thing going user-email, got nothing on email box. if 1 have idea how pass email value, pleas shear knowledge. tired problem , put 2 days on problem , still have no clue.

my code - application/view/email_temp.php -

<html style="background:#5d849e;background-size:cover;height:100%;">     <head>         <meta charset="utf-8" />         <meta name="viewport" content="width=device-width, initial-scale=1.0" />     </head>     <body>         <div>             <div style="background-color:rgba(72,72,72,0.4);padding-left:35px;padding-right:35px;padding-top:35px;padding-bottom:50px;width:650px;float:left;left:50%;position:absolute;margin-top:30px;margin-left:-300px;-moz-border-radius:7px;-webkit-border-radius:7px;">                   <form>                     <h1 align="center" style="color:#3c3c3c;font-family:helvetica,arial,sans-serif;font-weight:500;font-size:28px;border-radius:0;line-height:22px;background-color:#fbfbfb;padding:13px 13px 13px 54px;margin-bottom: 10px;width:100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box;    -ms-box-sizing: border-box; box-sizing: border-box; border: 3px solid rgba(0,0,0,0);"><b>new 1 contact you!</b>                     </h1><br>                         <table align="left" style="color:#3c3c3c;font-family:helvetica,arial,sans-serif;font-weight:500;font-size:22px;border-radius:0;line-height:22px;background-color:#fbfbfb;padding:13px 13px 13px 54px;margin-bottom: 10px;width:100%;    -webkit-box-sizing: border-box; -moz-box-sizing: border-box;    -ms-box-sizing: border-box; box-sizing: border-box;border: 3px solid rgba(0,0,0,0);">                           <tbody>                             <tr height="50px;"><th align="left">company name : </th><td><?php echo $cname;?></td></tr>                             <tr height="50px;"><th align="left">name : </th><td><?php echo $name;?></td></tr>                              <tr height="50px;">                               <th align="left">phone : </th><td><?php echo $phone;?></td>                             </tr>                                 <tr height="50px;">                               <th align="left">address : </th><td><?php echo $address;?></td>                             </tr>                             <tr height="50px;">                               <th align="left">state : </th><td><?php echo $state;?></td>                             </tr>                             <tr height="50px;">                               <th align="left">contry : </th><td><?php echo $country;?></td>                             </tr>                             <tr height="50px;">                               <th align="left">accreditation standard : </th><td><?php echo $accre;?></td>                             </tr>                             <tr height="50px;">                               <th align="left">describe requirements : </th><td><?php echo $requir;?></td>                             </tr>                             <tr height="50px;">                               <th align="left">email : </th><td><?php echo $name;?></td>                             </tr>                           </tbody>                         </table>                 </form>             </div>         </div>     </body> </html> 

application/controller/contactus.php

<?php defined('basepath') or exit('no direct script access allowed'); class contactus extends ci_controller {         function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->library('email'); } public function contactmailsend()     {                       $data = array(         'cname' => $this->input->post('contact_cname'),         'name' => $this->input->post('contact_name'),         'useremail' => $this->input->post('cemail'),         'phone' => $this->input->post('contact_phone'),         'address' => $this->input->post('contact_address'),         'state' => $this->input->post('contact_state'),         'country' => $this->input->post('contact_country'),         'accre' => $this->input->post('contact_accre'),         'requir' => $this->input->post('contact_requir')         );        $subject="urgent || new persone || contact you";        $this->load->library('email');        $this->email->set_newline("\r\n");        $this->email->from('abc@gmail.com');        $this->email->to('abc@gmail.com');        $this->email->subject($subject);        $body=$this->load->view('email_temp', $data, true);        $this->email->message($body);               if($this->email->send())        {            echo "mail send successfully";        }        else        {            echo "not send mail";         } } ?> 

application/view/contact.php

<!-- link toaster --> <!-- <link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" rel="stylesheet" /> --> <!-- end -->  <!-- css toaster --> <style type="text/css">  #toast-container > .toast {     background-image: none !important; }  #toast-container > .toast:before {     position: fixed;     font-family: fontawesome;     font-size: 24px;     line-height: 18px;     float: left;     color: #fff;     padding-right: 0.5em;     margin: auto 0.5em auto -1.5em; }         #toast-container > .toast-warning:before {     content: "\f003"; } #toast-container > .toast-error:before {     content: "\f001"; } #toast-container > .toast-info:before {     content: "\f005"; } #toast-container > .toast-success:before {     content: "\f003"; }  </style> <!-- end -->      <section id="inner-headline">     <div class="container">         <div class="row">             <div class="col-lg-12">                 <ul class="breadcrumb">                     <li><a href="<?php echo base_url();?>"><i class="fa fa-home"></i></a><i class="icon-angle-right"></i></li>                     <li>contact us<i class="icon-angle-right"></i></li>                 </ul>             </div>         </div>     </div> </section>  <div class="container">              <div class="row">                 <div class="col-lg-12">                  <div class="col-md-8">                      <h1>contact </a></h1>                     <hr>      <form id="contact-form" onsubmit="return validate();" method="post" action="<?php base_url(); ?>contactus/contactmailsend" role="form">      <div class="messages"></div>      <div class="controls">          <div class="row">             <div class="col-md-6">                 <div class="form-group">                     <label for="contact_cname">companyname *</label>                     <input id="contact_cname" type="text" name="contact_cname" class="form-control" placeholder="please enter company name *" required="required" data-error="firstname required.">                     <div class="help-block with-errors"></div>                 </div>             </div>             <div class="col-md-6">                 <div class="form-group">                     <label for="contact_name">name *</label>                     <input id="contact_name" type="text" name="contact_name" class="form-control" placeholder="please enter name *" required="required" data-error="lastname required.">                     <div class="help-block with-errors"></div>                 </div>             </div>         </div>         <div class="row">             <div class="col-md-6">                 <div class="form-group">                     <label>email *</label>                     <input type="email" name="cemail" class="form-control" placeholder="please enter email *">                     <div class="help-block with-errors"></div>                 </div>             </div>             <div class="col-md-6">                 <div class="form-group">                     <label for="contact_phone">phone</label>                     <input id="contact_phone" type="tel" name="contact_phone" class="form-control" placeholder="please enter phone">                 </div>             </div>         </div>         <div class="row">             <div class="col-md-6">                 <div class="form-group">                     <label for="contact_address">address *</label>                     <input id="contact_address" type="text" name="contact_address" class="form-control" placeholder="please enter address *" required="required" data-error="firstname required.">                     <div class="help-block with-errors"></div>                 </div>             </div>             <div class="col-md-6">                 <div class="form-group">                     <label for="contact_state">state *</label>                     <input id="contact_state" type="text" name="contact_state" class="form-control" placeholder="please enter state *" required="required" data-error="lastname required.">                     <div class="help-block with-errors"></div>                 </div>             </div>         </div>         <div class="row">             <div class="col-md-6">                 <div class="form-group">                     <label for="contact_country">country *</label>                     <input id="contact_country" type="text" name="contact_country" class="form-control" placeholder="please enter country *" required="required" data-error="firstname required.">                     <div class="help-block with-errors"></div>                 </div>             </div>             <div class="col-md-6">                 <div class="form-group">                     <label for="contact_accre">accreditation standard *</label>                     <input id="contact_accre" type="text" name="contact_accre" class="form-control" placeholder="please enter enquiry standard *" required="required" data-error="lastname required.">                     <div class="help-block with-errors"></div>                 </div>             </div>         </div>         <div class="row">             <div class="col-md-12">                 <div class="form-group">                     <label for="contact_requir">describe requirements *</label>                     <textarea id="contact_requir" name="contact_requir" class="form-control" placeholder="describe requirements *" rows="4" required="required" data-error="please,leave describtion of requirements."></textarea>                     <div class="help-block with-errors"></div>                 </div>             </div>             <div class="col-md-12">                 <input type="submit" class="btn btn-success btn-send" value="send message">             </div>         </div>     </div>  </form> </div> <br><br><br>     <div class="col-md-1"></div>     <div class="col-md-3">         <h3>mail -</h3>         <a href="mailto:iafuk.org@gmail.com"><strong>iafuk.org@gmail.com</strong></a>         <br><br>         <h3>address -</h3>         <address>             <strong>iaf-uk akkreditering forum limited</strong><br>              suite 20, 196 rose street<br>              edinbugh, eh2 4at, uk          </address>               <strong>phone - (123) 364-7562 / (123) 526-6892</strong>         </div>  </div> </div> </div> 

assets/js/validation.js - use toaster @ button click

function validate() {  $cname = document.getelementbyid('contact_cname'); $name = document.getelementbyid('contact_name');  $phone = document.getelementbyid('contact_phone'); $address = document.getelementbyid('contact_address'); $state = document.getelementbyid('contact_state'); $country = document.getelementbyid('contact_country'); $accre = document.getelementbyid('contact_accre'); $requir = document.getelementbyid('contact_requir'); if($cname.value == '' || $cname.value == null || $name.value == '' || $name.value == null || $phone.value == '' || $phone.value == null) {     return false; } else {     showtoast(); return true;  } } 


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 -