Hello.
New to PHP and have written the code below. I am creating a basic
booking form that is submitted to code below. Haven't got
authentication but would like to.
- When the form is submitted, an email is sent ONLY to myself. I
have hard coded this, will this be secure and stop injections?
- I'd like the user to be given a unique reference for the booking,
like 'ref = AB090867' How would I do this?
- Finally it would be a great idea to store the booking into database
incase the email doesn't reach or vis versa store in database then
email? any ideas?
Thanks.
<?php
error_reporting(0);
@extract($_POST);
$strMyEmailAddress = "m...@x.com";
$Subject = "Try 1";
$strReturnEmailAddress = stripslashes($EMail);
$strBody = "<html><head></head><body><b>MY SUBJECT</b>";
$strBody = $strBody ."<b>Name: </b>" . stripslashes($Title) . ". " .
stripslashes($FirstName) . " " . stripslashes($LastName);
$strBody = $strBody ."<br><b>Telephone: </b>" . stripslashes($Tel);
$strBody = $strBody ."<br><b>Fax: </b>" . stripslashes($Fax);
$strBody = $strBody ."<br><b>E-mail: </b>" . $strReturnEmailAddress;
$strBody = $strBody ."</body></html>";
$strReturnEmailAddress = $strMyEmailAddress;
mail($strMyEmailAddress,$Subject,
$strBody,"From:".stripslashes($Title)." ".stripslashes($FirstName)."
".stripslashes($LastName)." <$strReturnEmailAddress>\n" ."MIME-
Version: 1.0\n" ."Content-type: text/html; charset=iso-8859-1");
?>
......
<p>Thank-you for completing the form. Your unique reference is
XXXXXXX. </p>