[請益] form表單無法輸出至下一頁

看板PHP作者 (安卓羅)時間19年前 (2006/06/19 15:40), 編輯推噓2(204)
留言6則, 3人參與, 最新討論串1/2 (看更多)
這實在是一個很簡單很單純的 php 讀取表單的網頁, 可是無奈太久沒有碰 php, 我竟然連這個也攪不定..Orz..。 我是使用 EasyPHP 1.7 版此套裝程式, 包含了 PHP4.3.3、MySQL4.0.15、Apache1.3.27、PhpMyAdmin2.5.3, 而參考書目則是 PHP4 網站實作,作者為陳俊宏, 以下為書中的留言板範例, 無奈我怎麼跑都跑不出來, 還麻煩版上的前輩多多幫忙指教~~ //////////////////////////////////////////////////////////////////// // 以下為 post.html 表單的html碼 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <title>神經留言板</title> </head> <body> <form method="POST" action="show.php"> <div align="center"><center> <table border="0" width="80%" cellspacing="1"> <tr> <td width="11%" bgcolor="#C0C0C0"> <strong>筆名</strong></td> <td width="89%"> <input type="text" name="username" size="20"></td> </tr> <tr> <td width="11%" bgcolor="#C0C0C0"> <strong>E-Mail</strong></td> <td width="89%"> <input type="text" name="email" size="20"></td> </tr> <tr> <td width="11%" bgcolor="#C0C0C0" valign="top"> <strong>留言</strong></td> <td width="89%"> <textarea rows="4" name="message" cols="36"> </textarea><br> <input type="submit" value="送出" name="B1"> <input type="reset" value="重填" name="B2"></td> </tr> </table> </center></div> </form> </body> </html> // 以下為 show.php 輸出頁 <?php echo "筆名:$username<br>"; echo "E-Mail:$email<br>"; echo "留言:<br>$message"; ?> //////////////////////////////////////////////////////////////////// 我按下送出後, show.php 的網頁呈現出以下: Notice: Undefined variable: username in c:\program files\easyphp1-7\www\php4www \ch04\show.php on line 2 筆名: Notice: Undefined variable: email in c:\program files\easyphp1-7\www\php4www\ch 04\show.php on line 3 E-Mail: Notice: Undefined variable: message in c:\program files\easyphp1-7\www\php4www\ ch04\show.php on line 4 留言: 未定義的變數? 是我的php設定上有問題? EasyPHP啟動之後應該就啟動所有了吧?!~ 不知道是哪個環節出問題~ 麻煩幫我看一下嚕~ 這個應該是個小問題吧....Orz...感謝先嚕~!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.168.78.108

06/19 16:19, , 1F
php.ini有設定global嗎 沒有的話要用$_POST['xxx']吧
06/19 16:19, 1F

06/19 17:02, , 2F
大感謝!! 原來在php.ini中有兩個 register_globals = Off~
06/19 17:02, 2F

06/19 17:03, , 3F
我只改了一個 register_globals = on ! 剛剛兩個都改成on
06/19 17:03, 3F

06/19 17:04, , 4F
就可以跑出來了!太感謝了!! >"< !!
06/19 17:04, 4F

06/19 17:06, , 5F
不過..請問一下..若是使用 $_POST['xxx']..是加在哪兒呢??
06/19 17:06, 5F

06/19 18:35, , 6F
echo $_POST['email'] ; echo $_POST['username'];
06/19 18:35, 6F
文章代碼(AID): #14bbJjzL (PHP)
文章代碼(AID): #14bbJjzL (PHP)