PHP:糟糕的电话号码会保留我的电子邮件

时间:2016-07-01 15:53:13

标签: php text phone-number

我试图通过此表单将客户的信息通过电子邮件发送给我,但是如果电话号码没有用短划线或括号完全输入,那么它就会在外面丢失空间。有没有办法把它变成一个纯文本字段,这样如果以任何方式输入它,它仍然会通过电子邮件发送给我?谢谢你的帮助,德鲁

<?
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$city=$_POST['city'];
$message=$_POST['message'];

$ToEmail = "mrkuespert@hotmail.com";
$ToSubject = "Message from Island Photo Booths";

$EmailBody =   "Name: $name\n 
                Email: $email\n
                Phone: $phone\n
                City: $city\n
                Message: $message\n";

$Message = $EmailBody;


$headers .= "Content-type: text; charset=iso-8859-1\r\n";
$headers .= "From:".$name." / ".$email."\r\n";

mail($ToEmail,$ToSubject,$Message, $headers);

?>

0 个答案:

没有答案