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

看板PHP作者 (屎面人)時間19年前 (2006/06/21 20:40), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
你需要在第二支程式裡面的一開頭 讓程式先知道你的變數是從哪來的 你應該是漏寫了這幾個 $username = $_post['username']; $email = $_post['email']; ※ 引述《andraw (安卓羅)》之銘言: : 這實在是一個很簡單很單純的 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: 59.120.152.56
文章代碼(AID): #14cJvJUW (PHP)
討論串 (同標題文章)
文章代碼(AID): #14cJvJUW (PHP)