薩拉姆所有球員的...我已經陷在多個功能在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