【发布时间】:2011-12-07 08:39:00
【问题描述】:
我需要在一个数组中检索上传输入字段的值,让我解释一下:
我有这些输入字段:
<input type='text' name='field["+ j++ +"]' value='' data-kind='title' />
<input type='file' name='field["+ j++ +"]' value='' data-kind='image' />
<input type='text' name='field["+ j++ +"]' value='' data-kind='title' />
<input type='file' name='field["+ j++ +"]' value='' data-kind='image' />
我从这些字段中打印_r 字段数组并得到它:
Array
(
[0] => title 1
[2] => title 2
)
而不是:
Array
(
[0] => title 1
[1] => image1.jpg
[2] => title 2
[3] => image2.jpg
)
我需要在我的数组中包含我的文件名,我怎样才能拥有第二个数组?
我尝试过合并,但是我需要保留数组中每个字段的位置,就像表单中每个输入的顺序一样(例如:如果上传字段是在第一个生成的我需要将该信息保存在数组中的表单位置([0] => image1.jpg [1] => title1 等等)
任何会帮助将非常非常感激!几天以来我一直被困在这上面:(
【问题讨论】:
标签: php jquery arrays input upload