我有這樣兩個文件PHP - 變量裏面嵌套如果isset不顯示
a.php只會
<?
echo "
<form action = 'B.php' method = 'post'>
Age: <input type = 'text' name = 'age'>
<input type = 'submit' name = 'send' value = 'send'>
</form>
";
?>
B.php
<?
$age = $_REQUEST ['age'];
if (isset($_POST['send'])){
echo "Are you sure you wanna send this age?";
echo "
<form action = 'B.php' method = 'post'>
<input type = 'submit' name = 'age2' value = 'YES'>
";
if (isset($_POST['age2']) && !isset($_POST['send'])){
echo "Your final age is".$age; //It doesn't display!!! :(
}
echo "</form>";
}
?>
如果我刪除了第二個ifset, $年齡將被顯示。
如果你意識到,在第二個isset中我有兩個條件,第一個,必須點擊YES按鈕,第二個,發送按鈕不能被點擊。
我已經嘗試了許多這和我沒有得到這個:(
PS我想在同一個頁面中顯示它。沒有其他頁面。 如果這是不可能的這一點,那麼我會在其他頁面。
凡在窗體的AGE2歲? –
age2是確認年齡 – seRgiOOOOOO
的第二個按鈕,對不起,我的錯誤,它不是prueba-2,它是B,已編輯 – seRgiOOOOOO