作者tempTTP1 (任劍翔)
看板PHP
標題[請益] 沒有顯示結果?
時間Thu Jul 2 20:02:22 2009
請大大們幫我看看:
在test1.htm中:
<html>
<body>
.......
<center>
<form action="response.php" method="post">
username:<input type="text" name="username"><br>
password:<input type="password" name="password"><br>
gender: male<input type="radio" name="gender"
value="male">female<input type="radio" name="gender" value="female"><br>
habit: <input type="checkbox" name="h1">打電腦 <input
type="checkbox" name="h2">聽音樂 <input type="checkbox" name="h3">看書<br>
<input type="submit" value="送出">
</form>
</center>
</body>
</html>
在response.php中:
<html>
<body>
<center>
<?php
echo "帳號:";echo $username;
echo "<br>密碼:";echo $password;
if($gender=="male"){
echo "<br>性別: 男<br>";
}
else if($gender=="female"){
echo "<br>性別: 女<br>";
}
echo "興趣: ";
if($h1=="on"){
echo "打電腦 ";
}
if($h2=="on"){
echo "聽音樂 ";
}
if($h3=="on"){
echo "看書 ";
}
echo "您已成功加入會員<br>";
?>
</center>
<a href="
http://www.yahoo.com.tw">回首頁</a>
</body>
</html>
不知道為什麼,好像變數都沒有存進去...
感謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.164.109.64
推 arrack :沒看到設定接收參數的部分 07/02 20:24
→ tempTTP1 :不是在<input name="XX">就代表在php檔能用$XX變數嗎 07/02 20:28
→ tempTTP1 :$XX值就是輸入的字串或value這樣? 07/02 20:29
推 sgin33 :echo $_POST["username"]; 07/02 20:35
→ sgin33 :你說的好像是舊版php可以,新版好像不行了 07/02 20:35
→ tempTTP1 :No~~~~ 那所以若是get的話就是$_GET["username"]囉? 07/02 20:45
推 sgin33 :是的 07/02 20:53
推 arrack :設定檔要開才可以,沒記錯的話應該是global_variable 07/02 20:59
→ arrack :沒開的話就要乖乖的接收變數 07/02 21:00
→ arrack :建議還是不要偷懶的好 07/02 21:00
推 kusoayan :建議不要開global_variable 07/02 22:02
→ tempTTP1 :那問一下設定檔是什麼? 07/03 11:37
推 appleboy46 :php.ini 關掉 register_global 07/03 11:45