我的表单HTML
Enter Name:
Enter Email:
Enter DOB:
我的PHP表单 if(isset($_POST['Name']) && isset($_POST['Email']) && isset($_POST['Dob'])) {
$data = $_POST['Name'] . '-' . $_POST['Email'] . '-' . $_POST['Dob'] . "\n";
$ret = file_put_contents('mydata.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
$location = "success.html";
header( "Location: $location" );
表单工作正常,但我要验证:
名称只是字母表
电子邮件格式正确@ ect
DOB是数字
感谢所有可以提供帮助的人