我有elements
如下输入
<form method="post" >
1 <input type="text" name="passname[name]" /> <br/> <br/>
2 <input type="text" name="passname[type]" /> <br/> <br/>
3 <input type="text" name="passname[age]" /> <br/> <br/>
1 <input type="text" name="passname[name]" /> <br/> <br/>
2 <input type="text" name="passname[type]" /> <br/> <br/>
3 <input type="text" name="passname[age]" /> <br/> <br/>
<input type="submit" name="send" value="Submit" /> <br/>
</form>
我想要所有的text box
as 数组php
像下面
Passenger Name : passname[name]
Passenger Type : passname[type]
Passenger Age : passname[age]
这可能与php
表格中使用的表格代码
<input type="text" name="passname[name][]" /> <br/> <br/>
<input type="text" name="passname[type][]" /> <br/> <br/>
<input type="text" name="passname[age][]" /> <br/> <br/>
<input type="text" name="passname[name][]" /> <br/> <br/>
<input type="text" name="passname[type][]" /> <br/> <br/>
<input type="text" name="passname[age][]" /> <br/> <br/>
当我提交表单时,我得到这种类型的数组值
array
'passname' =>
array
'name' =>
array
0 => string '1' (length=1)
1 => string '1' (length=1)
'type' =>
array
0 => string '2' (length=1)
1 => string '2' (length=1)
'age' =>
array
0 => string '3' (length=1)
1 => string '3' (length=1)
'send' => string 'Submit' (length=6)
我怎么能在每一个喜欢的打击中做到这一点
<?php
if(isset($_POST['aa']))
{
$number = $_POST['1'];
$text = $_POST['2'];
foreach($number as $key=>$val)
{
echo $val."=".$text[$key]."<br />";
}
}
?>
<formid="a"name="a"method="post">
<selectid="1[]"name="1[]">
<optionvalue="1">1</option>
<optionvalue="3">3</option>
<optionvalue="2">2</option>
</select>
<inputtype="text"value=""id="2[]"name="2[]"/>
<selectid="1[]"name="1[]">
<optionvalue="1">1</option>
<optionvalue="3">3</option>
<optionvalue="2">2</option>
</select>
<inputtype="text"value=""id="2[]"name="2[]"/>
<inputtype="submit"id="aa"name="aa"value="send now"/>
</form>