Php 通过动态复选框启用和禁用文本框数组

Php 通过动态复选框启用和禁用文本框数组,php,jquery,Php,Jquery,我有一些动态复选框和相应的动态文本框 while($row = mysql_fetch_assoc($result)) { ?> <td><input type="checkbox" class="album_checkbox" id="phone[]" name="phone[]" value="<?=$row['mobile_no']?>" > </td> <td> <input type="text"

我有一些动态复选框和相应的动态文本框

while($row = mysql_fetch_assoc($result)) {
?>   

<td><input type="checkbox" class="album_checkbox" id="phone[]" name="phone[]" value="<?=$row['mobile_no']?>" > </td>    
<td>
 <input type="text" class="album_text"  id="txt1[]" name="txt1[]" style="width: 15em" value="<?=$row['name']?>" disabled="disabled"> 
</td>
该代码只会完美地输入勾选的复选框值,但如果我勾选了动态复选框的复选框1、3和5,它将循环3次,并且只插入文本框1、2、3中的值,而不是1、3、5中的值

有人能给我指一下正确的方向吗

请提供相同的php代码


谢谢。

您可以根据复选框值设置textbox的disabled属性:

$('input.album_checkbox').click(function(){

       $(this).closest('td').next('td').children('input').attr('disabled',!this.checked)

});
$('.album_checkbox').click(function () {
            if (!this.checked)
                $(this).closest('td').next('td').children('input').attr('disabled', "disabled");
            else
                $(this).closest('td').next('td').children('input').removeAttr('disabled');
        });
$('.album_checkbox').click(function () {
            if (!this.checked)
                $(this).closest('td').next('td').children('input').attr('disabled', "disabled");
            else
                $(this).closest('td').next('td').children('input').removeAttr('disabled');
        });