\d数字 \w数字字母 \s空白符 ^以什么开头 $什么结尾 [] ()组 ?有或没有 {2}次数 [^1-2]除1,2以外的字符
preg_match($regex,$string) preg_replace($pattern,$replacement,$string)
$new_phone = preg_replace('/[\(\)\-\s]/', '', $phone) 去掉(- )换成空 便于数据库统一储存格式
<!-- 电话号码/邮箱正则验证 -->
<!DOCTYPE html>
<html>
<head>
<title>Risky Jobs Registration</title>
</head>
<body>
<h3>Risky Jobs - Registration </h3>
<?php
require_once('define.php');
if (isset($_POST['submit'])) {
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$job = $_POST['job'];
$resume = $_POST['resume'];
$output_form = 'no';
if (empty($firstname)) {
echo '<p>You forgot to enter your first name.</p>';
$output_form = 'yse';
}<