I am new in php. Not able to send these values to mail. I want to send this form value to mail and my database both. And is 2 mail possible? I use this form as popup on my website all right in form code it is sending values to database.
<?php
$servername = 'localhost';
$username = '********';
$password = '*****';
$dbname = '********';
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_REQUEST['mailsend']))
{
$firstname = $_POST['FirstName'];
$email = $_POST['email'];
$number = $_POST['number'];
$query = $_POST['query'];
$subject = "A New Query";
$message = "Name:" .$firstname. "
";
$message .=" Email:" .$email. "
" ;
$message .= "Mobile Number:" .$number. "
";
$message .= "Query:" .$query. "
";
print_r($message);
$sql = "INSERT INTO query (name,email,phone,query) VALUES ('$firstname', '$email', '$number', '$query')";
if ($conn->query($sql) === TRUE) {
echo "<script>alert('Your Message Sent Sucessfully, We will contact you soon.');</script>";
}
else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
?>