标签:
例子??
<meta charset="utf-8">
<?php
/**
* Created by PhpStorm.
* User: huangjiaming
* Date: 16/7/18
* Time: 下午5:15
*/
if(isset($_POST[‘submit‘])) {
@$fan = $_POST[‘fan‘];
@$email = $_POST[‘email‘];
$output_form = false;
if (empty($fan) && empty($email)) {
echo "邮箱和反馈不能为空";
$output_form = true;
}
if (!empty($fan) && empty($email)) {
echo "邮箱不能为空";
$output_form = true;
}
if (!empty($email) && empty($fan)) {
echo "反馈不能为空";
$output_form = true;
}
}
else{
$output_form = true;
}
if($output_form) {
?>
<form action="<?php echo $_SERVER[‘PHP_SELF‘] ?>" method="post">
<label for="email"> 邮箱:</label>
<input type="text" id="email" name="email" value="<?php echo @$email; ?>" /><br/>
<label for="fan"> 反馈:</label>
<input type="text" id="fan" value="<?php echo @$fan; ?>" name="fan" />
<input type="submit" value="sure" name="submit">
</form>
<?php
}
?>
标签:
原文地址:http://www.cnblogs.com/huangjiaming/p/5693716.html