[請益] 按一個按鈕傳兩個變數

看板PHP作者 (herber)時間18年前 (2008/02/27 01:02), 編輯推噓2(203)
留言5則, 3人參與, 最新討論串1/2 (看更多)
各位高手大家好 想請教一個問題 希望我的表單能夠在按下一個按鈕的之後 這個表單可以一次兩筆資訊給後端接收資料的 php 網頁 所以我這樣寫 不知道這樣的寫法到底對不對呢? <form action = "parser.php" method = "post"> <input type = "image" src = "XXX.jpg"> <input type = "hidden" name = "AAA"> </input> <input type = "hidden" name = "BBB"> </input> </input> </form> <form action = "parser.php" method = "post"> <input type = "image" src = "YYY.jpg"> <input type = "hidden" name = "AAA"> </input> <input type = "hidden" name = "CCC"> </input> </input> </form> 是這樣的 我剛剛試了好一陣子 我發現不論我按下的是第一個 form 裡面的按鈕 或者第二個的按鈕 在 parser.php 裡面 isset($_POST['BBB']) 似乎永遠都是 true 不知道是不是因為我這樣寫 在邏輯上有錯呢? 謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.193.18.177

02/27 01:08, , 1F
沒錯啊, 你把兩個隱藏欄位包在表單裡面送出, 那當然是true
02/27 01:08, 1F

02/27 01:08, , 2F
另外原po看哪本書/網站教你input可以這樣結尾的?
02/27 01:08, 2F

02/27 01:27, , 3F
因為書說 html 的 tag 都是 <xxx>開始</xxx>結尾 (誤)
02/27 01:27, 3F

02/27 01:47, , 4F
完全沒看到 指定 value 的部份呀
02/27 01:47, 4F

02/27 10:44, , 5F
部分元素不是這樣的結尾方式喔. <input ... />才是標準方式
02/27 10:44, 5F
文章代碼(AID): #17n4O97T (PHP)
文章代碼(AID): #17n4O97T (PHP)