萨拉姆所有球员的...我已经陷在多个功能在PHP单页在页面PHP多功能
例如我创建了一个登录()和家庭()时,我做我的登录它显示家庭但仍然登录哪有我只能一次查看一个功能..
这里是脚本
<?php
function login() {
if (isset($_POST['sub'])) {
$user = $_POST['user'];
$gender = isset($_POST['check']);
if ($user == "admin" && $gender == "male") {
echo "oh boy you have access to this site";
home();
} else if ($user == "admin" && $gender == "female") {
echo " Hey Lady.. You have access to this site";
home();
} else if ($gender == "" || $gender != "male" || $gender != "female") {
echo "please select gender";
} else if ($user == "" || $user == " ") {
echo "input username";
} else {
echo " '" . $user . "' " . " you enter is wrong";
}
}
}
?>
<?php
login();
?>
<form method="POST" >
<input type="text" name="user" placeholder="username" /><br>
Male: <input type="radio" value="male" name="check"> female : <input type="radio"
value="female" name="check" > <br> <input type="submit" name="sub">
</form>
<?php
function home() {
?>
<p><center>Practice of string a simple test home() </center></p>
<?php
$a = "multi thinker ";
$w = ucwords($a);
$trim = trim($a, " ");
$trim = ltrim($a, " ");
$trim = rtrim($a, " ");
echo $w . " " . $trim;
}
?>
$ gender = isset($ _ POST ['check']);将把性别设置为合乎逻辑的。我不认为这就是你想要的,因为你后来为男性,女性或空洞检查它。 – 2014-09-20 18:29:10
@Len_D这只是一个练习脚本移动到功能点离开这个性别现在:) – 2014-09-20 18:35:21