[問題] 表單傳送二維陣列

看板Web_Design作者 (.)時間15年前 (2010/09/14 17:29), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串1/1
我有以下這表單 <form name="form" method="post" action="abc.php"> <input type="text" name="test[][value]"> <input type="hidden" name="test[][id]" value="A123"> </form> 目前送出後到abc.php的資料結構是這樣: Array ( [test] => Array ( [0] => Array ( [value] => 輸入的值 ) [1] => Array ( [id] => A123 ) ) ) 送出後希望資料結構能夠這樣: Array ( [test] => Array ( [0] => Array ( [value] => 輸入的值 [id] => A123 ) ) ) 請問要怎麼做呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.125.41.241

09/15 00:34, , 1F
這個要用dom了
09/15 00:34, 1F

09/15 08:13, , 2F
input的name改成"test[0][value]",給test設明確的key值
09/15 08:13, 2F

09/15 08:14, , 3F
  "test[0][id]"
09/15 08:14, 3F

09/15 08:15, , 4F
呃...沒對齊到XD
09/15 08:15, 4F
文章代碼(AID): #1CZq1w8_ (Web_Design)