php注册界面,实现php欢迎用户登录界面

实现效果如图:

php实现代码如下:


<!DOCTYPE HTML>
<html>
<head>
<meta name="" content=""charset="utf-8"/>
</head>
<body>

<?php
// define variables and set to empty values
$name = $email = $gender = $comment = $website = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = test_input($_POST["name"]);
$email = test_input($_POST["email"]);
$website = test_input($_POST["website"]);
$comment = test_input($_POST["comment"]);
$gender = test_input($_POST["gender"]);
}

function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>

<h2>注册评论界面</h2>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
姓名:<input type="text" name="name">
<br><br>
性别:
<input type="radio" name="gender" value="female">女性
<input type="radio" name="gender" value="male">男性
<br><br>
qq:<input type="text" name="email">
<br><br>
电话:<input type="text" name="website">
<br><br>
评论:<textarea name="comment" rows="5" cols="40"></textarea>
<br><br>

<br><br>
<input type="submit" name="submit" value="提交">
</form>

<?php
echo "<h2>欢迎您注册登录:</h2>";
echo '欢迎:' . $name;
echo "<br>";
echo '你的性别是:' .$gender;
echo "<br>";
echo '你的qq是:' .$email;
echo "<br>";
echo '你的电话是:' .$website;
echo "<br>";
echo '你的评论是:' .$comment;


?>

</body>
</html>

posted @ 2018-07-24 22:48  我的博客笔记  阅读(1045)  评论(0编辑  收藏  举报