相關(guān)關(guān)鍵詞
關(guān)于我們
最新文章
form表單傳遞數(shù)組數(shù)據(jù)、php腳本接收的實例
通過數(shù)組傳遞表單數(shù)據(jù),可以保存數(shù)據(jù)之間的業(yè)務(wù)屬性關(guān)系,比如有很多Student,每隔Student都有姓名、年齡、性別、愛好等表單信息。提交表單后還需要針對每個student進(jìn)行處理或者保存。這樣肯定需要為每個student的這些屬性表單建立起關(guān)聯(lián)關(guān)系,一種方式是根據(jù)屬性表單的name上加特殊標(biāo)記進(jìn)行識別,但是數(shù)組傳遞表單就能使表單數(shù)據(jù)更結(jié)構(gòu)化。
例子如下:
<input type="hidden" name="msginfo[name][]" value="張三"/> <input type="hidden" name="msginfo[phonenum][]" value="111111111"/> <input type="hidden" name="msginfo[name][]" value="李四"/> <input type="hidden" name="msginfo[phonenum][]" value="222222222"/>