I have looked on other questions and nothing quite fits, I am trying to adapt parts to my code I have built so far, but the new stuff I am adding I get errors, I am sure I'm not far off. I want to learn to do it so I will keep trying.
I don't expect someone to do it for me, I want to do it and understand how it's working to constantly improve.
So my MySQL database has an ID field auto_increment and the clients details.
After my customer fills in the form, I would like an email with their ID number sent to their email address they have just put in the form. (make sense?)
Can I do this as the customer only gets an ID number in the database after filling out the form?
OK! so writing this I've just realized that maybe I can create a trigger inside MySQL database to send an email with the ID number to the client once the details enter the database.
I just googled that and not sure if its possible
So far my code is this and I built it and it works a treat! a long process but I'm getting there and loving it!
<?php
require 'connection.php';
$conn = Connect();
$date = $conn->real_escape_string($_POST['u_date']);
$name = $conn->real_escape_string($_POST['u_name']);
$company = $conn->real_escape_string($_POST['u_company']);
$tel = $conn->real_escape_string($_POST['u_tel']);
$mtel = $conn->real_escape_string($_POST['m_tel']);
$email = $conn->real_escape_string($_POST['u_email']);
$occupation = $conn->real_escape_string($_POST['occupation']);
$hear = $conn->real_escape_string($_POST['hear']);
$used = $conn->real_escape_string($_POST['used']);
$signature = $conn->real_escape_string($_POST['signature']);
$query = "INSERT into tb_cform (u_date,u_name,u_company,u_tel,m_tel,u_email,occupation,hear,used,signature) VALUES('" . $date . "','" . $name . "','" . $company . "','" . $tel . "','" . $mtel . "','" . $email . "','" . $occupation . "','" . $hear . "','" . $used . "','" . $signature . "')";
$success = $conn->query($query);
if (!$success) {
die("Couldn't enter data: ".$conn->error);
}
echo "<p><center>Thank you <strong>$name</strong>, your message has been submitted to us. Check your email for your ID number</center></p>";
$conn->close();
?>
Thank you in advance!