Guest User

Untitled

a guest
Dec 11th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. <?php
  2. $host = "localhost";
  3. $username = "0000000";
  4. $password = "0000000";
  5. $db_name = "0000000";
  6. $con=mysql_connect("$host", "$username", "$password") or die("cannot connect"); // MySQL connection
  7. mysql_select_db("$db_name") or die("can not select DB"); // Select database
  8. $name = $_POST['name'];
  9. $mobile = $_POST['mobile'];
  10. $email = $_POST['email'];
  11. $message = $_POST['message'];
  12. $rdDomestic = $_POST['rdDomestic'];
  13. $fromCity = $_POST['fromCity'];
  14. $toCity = $_POST['toCity'];
  15. $dtDeparture = $_POST['dtDeparture'];
  16. $dtReturn = $_POST['dtReturn'];
  17. $cmbAdult = $_POST['cmbAdult'];
  18. $cmbChild = $_POST['cmbChild'];
  19. $cmbChild = $_POST['cmbChild'];
  20. $cmbInfants = $_POST['cmbInfants'];
  21. $rdClass = $_POST['rdClass'];
  22.  
  23. $query = "INSERT INTO `insert_flight`(`F_Inq_ID`, `name`, `mobile`, `email`, `message`, `rdDomestic`, `fromCity`, `toCity`, `dtDeparture`, `dtReturn`, `cmbAdult`, `cmbChild`, `cmbInfants`, `rdClass`)
  24.  
  25. VALUES ('', '$name', '$mobile', '$email', '$message', '$rdDomestic', '$fromCity', '$toCity', '$dtDeparture', '$dtReturn', '$cmbAdult', '$cmbChild', '$cmbInfants', '$rdClass')";
  26. mysql_query($query) or die('Query "' . $query . '" failed: ' . mysql_error());
  27.  
  28. // Starting email sending data below //
  29. mysql_close($con);
  30.  
  31. $header = "From: $emailn" . "Reply-To: $emailn";
  32. $subject = "New Flight Inquiry Received";
  33. $email_to = "0000000@gmail.com";
  34. $message = "Full Name: $namen"
  35. . "Mobile: $mobilen"
  36. . "Email: $emailn"
  37. . "message: $messagen"
  38. . "From City: $fromCityn"
  39. . "To City: $toCityn";
  40. mail($email_to, $subject, $message, $header);
  41.  
  42. // End sending email data...
  43.  
  44. if ($query) { ?>
  45. <script language="javascript" type="text/javascript">
  46. alert('Thank you!!!! We received your request. We will contact you shortly.');
  47. window.location = 'index.php';
  48. </script>
  49. <?php
  50.  
  51. }
  52. else { ?>
  53. <script language="javascript" type="text/javascript">
  54. alert('Message failed. Please, 0000');
  55. window.location = 'index.php';
  56. </script>
  57.  
  58. <?php
  59. }
  60. ?>
  61.  
  62. $to = '0000000@gmail.com';
  63. $subject = 'New Flight Inquiry Received';
  64. $msg = '
  65. <html>
  66. <head>
  67. <title>User Details</title>
  68. <body>
  69. <table width="100%" border="0">
  70. <tr><td>Full Name</td><td>' . $name . '</td></tr>
  71. <tr><td>Mobile</td><td>' . $mobile . '</td></tr>
  72. <tr><td>Email</td><td>' . $email . '</td></tr>
  73. <tr><td>message</td><td>' . $message . '</td></tr>
  74. <tr><td>From City</td><td>' . $fromCity . '</td></tr>
  75. <tr><td>To City</td><td>' . $toCity . '</td></tr>
  76. </body>
  77. </html>';
  78. $from = 'MIME-Version: 1.0' . "rn";
  79. $from .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
  80. $from .= 'From: info@abcd.com';
  81. mail($to, $subject, $msg, $from);
Add Comment
Please, Sign In to add comment