on booking form need to sending email to me by php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bimpex
Forum Newbie
Posts: 5
Joined: Wed Jul 20, 2016 5:25 am

on booking form need to sending email to me by php

Post 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();

?>
-------
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

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

Post by Celauran »

Is there a question in there somewhere or were you just expecting us to write the code for you?
bimpex
Forum Newbie
Posts: 5
Joined: Wed Jul 20, 2016 5:25 am

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

Post 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
bimpex
Forum Newbie
Posts: 5
Joined: Wed Jul 20, 2016 5:25 am

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

Post 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" );
?>
Post Reply