经测试代码如下:
<?PHP
/**
* 校验邮箱地址
*
* @param
* @arrange (512.笔记) jb51.cc
**/
if(isset($_POST['email'])){
$email = $_POST['email'];
if(filter_var($email,FILTER_VALIDATE_EMAIL)){
echo '<p>This is a valid email.<p>';
}else{
echo '<p>This is an invalid email.</p>';
}
}
?>
<form action="" method="post">
Email: <input type="text" name="email" value=" <?PHP echo $_POST['email']; ?> ">
<input type="submit" value="Check Email">
</form>
/*** 来自编程之家 jb51.cc(jb51.cc) ***/