By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,069 Members | 1,249 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,069 IT Pros & Developers. It's quick & easy.

How can I send mail using mail function through post method. I don't know where i did

P: 1
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.       if(isset($_POST['order']))
  3.       {
  4.          require_once("connection.php");
  5.         $query= "insert into order1 (`total`,`quantity`,`firstname`,`date_createdAt`,`email`,`address`,`city`,`state`,`telephone`,`mobile2`,`comments`) values ('".$total."','".$quantity."','".$_POST['firstname']."','".date("Y-m-d h:i:s")."','".$_POST['email']."','".$_POST['address']."','".$_POST['city']."','".$_POST['state']."','".$_POST['telephone']."','".$_POST['telephone2']."','".$_POST['Comments']."')";
  6.         $result =  mysqli_query($con, $query) or die(mysqli_error($con));
  7.         $max_query = mysqli_query($con, "SELECT  max(id) FROM order1 ") or die(mysqli_error($con));
  8.         $max_row = mysqli_fetch_array($max_query);
  9.  
  10.  
  11.  if($cart){
  12.         foreach($cart as $k=>$v)
  13.         {
  14.              mysqli_query($con, "insert into product_order (`product_id`,`order_id`) values ('".$v->id."','".$max_row[0]."')") or die(mysqli_error($con));
  15.         }
  16.  }
  17.  
  18.  
  19.  
  20.  
  21.     unset($_SESSION['cart']);
  22.     unset($_SESSION['count']);
  23.  
  24. $to=$_POST['email'];
  25. $subject = 'Order';
  26. $message = 'your order has been received';
  27. $headers = 'From:info@booksjerry.com' . "\r\n" .
  28.     'Reply-To: info@booksjerry.com' . "\r\n" .
  29.     'X-Mailer: PHP/' . phpversion();
  30.  
  31. if(mail($to, $subject, $message, $headers)){
  32.  echo"Mail Successfully Sent";
  33.  
  34.        }
  35.        else{
  36.             echo"Mail Could not be Sent";
  37.        }
  38.       ?>
Apr 8 '20 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.