Page 1 of 1

on booking form need to sending email to me by php

Posted: Mon Oct 17, 2016 5:49 am
by bimpex
on booking form need to sending email to me by php

booking form and insert data in to mysql database working fine.
(for this i am using two files, eg. booking.html, bookingInsert.php)

on booking form need to sending email to me by php
(to know the data immediately in my email)

mysql Server version: 5.5.52
phpmyadmin Version information: 4.0.10.14

bookingform -html file pasted
insert -php file pasted

Thanks
R.Chandrasekar
Email: bimpexrcs@gmail.com
Skype: bimpexrcs


----------------
form -html file
-----------

Code: Select all

<!DOCTYPE html>

<html>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

  <body>
    <title>Booking</title>
    <h3>Booking :</h3>
    <form action="bookingInsert.php" method="POST" />
        <p>Name: <input type="text" name="name" /></p>
        <p>Mobile_Number: <input type="text" name="mobile" /></p>
        <p>Email: <input type="text" name="email" /></p>
        <p>Pickup_Place: <input type="text" name="pickup_place" /></p>
        <p>Drop_Place: <input type="text" name="drop_place" /></p>
        <p>Car_Type: <input type="text" name="car_type" />&nbsp; (Indica Rs.15 per         km/Tavera Rs.19 per km/Innova Rs.24 per km)</p>
        <p>Pickup_Time: <input type="text" name="pickup_time" /></p>
        <p>Drop_Time: <input type="text" name="drop_time" /></p>
        <p>Message: <input type="text" name="message" />&nbsp; (To Calculate the distance 
        use: Google Maps <a href="https://maps.google.co.in">https://maps.google.co.in</a>)</p>
		<blockquote>
			<blockquote>
				<p>&nbsp;<input type="submit" value="Book" /></p>
			</blockquote>
		</blockquote>
    </form>
  </body>
</html>

-------------
insert -php file
---------

Code: Select all

<?php

define('DB_NAME', 'xxxx');
define('DB_USER', 'xxxxx');
define('DB_PASS', 'xxxx');
define('DB_HOST', 'xxxx');

$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);

if(!$link)
{
    die('Could not connect to database: ' . mysql_error());
}

$db_select = mysql_select_db(DB_NAME);

if(!$db_select)
{
    die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
}

echo "Booking";
$name = $_POST['name'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$pickup_place = $_POST['pickup_place'];
$drop_place = $_POST['drop_place'];
$car_type = $_POST['car_type'];
$pickup_time = $_POST['pickup_time'];
$drop_time = $_POST['drop_time'];
$message = $_POST['message'];


$query = "INSERT INTO booking (name, mobile, email, pickup_place, drop_place, car_type, pickup_time, drop_time, message) VALUES ('$name', '$mobile', '$email', '$pickup_place', '$drop_place', '$car_type', '$pickup_time', '$drop_time', '$message')";
if(!mysql_query($query))
{
    die("your data is incorrect try again");
}
else{ echo "Success"; }

mysql_close();

?>
-------

Re: on booking form need to sending email to me by php

Posted: Mon Oct 17, 2016 6:29 am
by Celauran
Is there a question in there somewhere or were you just expecting us to write the code for you?

Re: on booking form need to sending email to me by php

Posted: Mon Oct 17, 2016 6:51 am
by bimpex
Celauran wrote:Is there a question in there somewhere or were you just expecting us to write the code for you?
1.form and sending email working
2.form, insert and sending email working
3.i tried many times many method for sending email but not working

so expecting you to write the fresh code for me for sending email

Re: on booking form need to sending email to me by php

Posted: Mon Oct 17, 2016 7:49 am
by bimpex
finally this php function email.php works fine for me

--------------
<?php

$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;

// here we use the php mail function
// to send an email to:
// you@example.com
mail( "bimpexrcs@gmail.com", "Feedback Form Results",$message, "From: $email" );
?>