I have a simple php script which I use in form on my website. It works fine, however in a title of a message I receive, I would like to have (next to the “Quote Request”) a date taken from the field called “date”. I was playing with this code but it didn’t work. I know the answer is probably very simple, but I don’t know php (yet). How can I do it?
Thank you for any help. The code below.
<?php
$addressto = "email@email.com";
$subject = "Quote Request";
$content = "Name: ".$_POST['name']."\n"
."Date: ".$_POST['date']."\n";
if(!$_POST['name'] || !$_POST['date']){
header("Location: ../quote.html");
exit;
}
$email = $_POST['email'];
if(mail($addressto, $subject, $content, 'From: Contact <'.$email.'>')){
header("Location: ../sent.html");
}
?>
You mean:
Make sure you’re validating the user input so as not to get yourself exploited!