我有一段代码在通过 Ajax 单击特定按钮时加载。
我给每个输入一个名字,比如txtname[]
,country[]
和radiobtn[]
.
问题是,当我两次填充这三个字段并在第二次迭代中选择一个单选按钮然后通过打印帖子数组时print_r($_POST);
显示以下结果:
[txtname] => Array ( [0] => xyz[1] => abc)[country] => Array ( [0] => India[1] => United Kingdom ) [radiobtn] => Array ( [0] => true )
它不应该显示为:
[txtname] => 数组 ( [0] => xyz[1] => abc)[country] => 数组 ( [0] => 印度[1] => 英国) [radiobtn] => 数组 ( [0 ] => ""[1] => 真)
那么如何知道选择了哪个迭代单选按钮呢?任何帮助表示赞赏。
HTML
<input type="radio" name="radiobtn[]" value="true">
<input type="text" name="txtname[]" >
<select name="country[]">
<option value="country" selected="selected">Select Country</option>
<option value="United States" >India </option>
<option value="United Kingdom">United Kingdom</option>
</select>