1
我想獲取多個文本框的值,對應於所選的複選框...我們可以一次選擇一個或多個複選框,並在按鈕上單擊輸出我需要的是這樣的: 假設我的數組是這樣的: array1('first','second','third'); array2('a','b','c','d','e','f','g','h','i') 。 和輸出我需要的是: -php通過複選框和相同行或多行的文本框獲取多維數組的錯誤
第一,A,B,C
第二,d,E,F
第三,G,H,I
PLZ建議我! 這裏是我的演示代碼:
<?php
if(isset($_REQUEST["button7"]))
{
if(isset($_POST['check1']))
{
if (is_array($_POST['check1']))
{
foreach($_POST['check1'] as $key=> $value)
{
echo "<br>checkbox value is $key :". $value;
if (is_array($_POST['hindi']))
{
foreach($_POST['hindi'] as $value)
{
echo "<br>".$value;
}
}
}
}
}
}
?>
<form name="files" action="demp.php" method="post">
<table width="300" border="1" >
<tr>
<th>check value</th>
<th>English Name</th>
<th>Hindi Name</th>
<tr>
<?php
for($i=0;$i<10;$i++)
{?>
<td><input name="check1[]" class="checkbox2" type="checkbox" id="check1" value="<?php echo "checkboxvalue = ".$i;?>" /></td>
<td><input type="text" value="" name="hindi[]" id="txt1"></td>
<td><input type="text" value="" name="hindi[]" id="txt2"></td></tr>
<?php
}
?>
</table>
<input type="submit" name="button7" value="edit_pdf">
尼斯回答。得到了我的輸出。非常感謝。 – Nitish
不客氣。樂意效勞。 –
@Uchiha爲什麼「遞歸」?在'array_merge'很好的情況下工作? – splash58