我第一次尝试使用PHP而且我正在努力。我不希望任何人劫持我的表单以向其他人发送垃圾邮件。这样做吗?表单是用HTML格式的,当你点击提交时,它会通过POST调用orderform.php
<?php <!-- this is orderform.php -->
$to = 'myemail@myemil.com'; <!-- this is my hard coded email address-->
$subject = 'Order Form';
$message = 'First Name: '. filter_var($_POST['first_name']."\n", FILTER_SANITIZE_STRING)
.'Last Name: '. filter_var($_POST['last_name']."\n", FILTER_SANITIZE_STRING)
.'Mobile Phone: '. filter_var($_POST['phone']."\n", FILTER_SANITIZE_STRING)
.'Email: '. filter_var($_POST['email'], FILTER_SANITIZE_EMAIL)."\n"
.'Date: '. filter_var($_POST['date']."\n", FILTER_SANITIZE_STRING)
.'Time: '. filter_var($_POST['time']."\n", FILTER_SANITIZE_STRING)
.'Location: '. filter_var($_POST['location']."\n", FILTER_SANITIZE_STRING)
.'Special Requests: '. filter_var($_POST['special']."\n", FILTER_SANITIZE_STRING)
.'Service: '.$_POST['service']."\n"
.'Package: '.$_POST['package']."\n"
.'Photo Studio: '.$_POST['studio']."\n"
.'Makeup: '.$_POST['makeup']."\n"
.'Photo Editing: '.$_POST['editing'];
mail($to,$subject,$message);
header("Location: success.html");
?>
谢谢!