控制器代码:-
for($x = 0; $x < sizeof($birds); $x++){ $reslt[$x] = array( "birds" => $birds[$x], "qtt" => $qtt[$x], "red" => $red[$x], "blue" => $blue[$x], "grey" => $grey[$x], "yellow" => $yellow[$x], "dark" => $dark[$x] ); }$this->db->update_batch('db_birds', $reslt, 'birds');
更改在您的视图代码中:-
<?php//sql Query.//execute Query.$ii=0;foreach($dps as $dp){ $iii = $ii++; <tr> <td><input type="hidden" name="birds[<?php echo $iii;?>]" value='<?php echo $dp['birds']; ?>' /><?php echo $dp['birds']; ?></td> <td><p align='center'><input type="text" name="qtt[]" value='<?php echo $dp['qtt']; ?>' tabindex="2" /></td> <td><p align='center'><input type="checkbox" name="red[<?php echo $iii;?>]" value='1' <?php if($dp['red']==1) { echo " checked="checked""; } ?> /></td> <td><p align='center'><input type="checkbox" name="blue[<?php echo $iii;?>]" value='1' <?php if($dp['blue']==1) { echo " checked="checked""; } ?> /></td> <td><p align='center'><input type="checkbox" name="grey[<?php echo $iii;?>]" value='1' <?php if($dp['grey']==1) { echo " checked="checked""; } ?> /></td> <td><p align='center'><input type="checkbox" name="yellow[<?php echo $iii;?>]" value='1' <?php if($dp['yellow']==1) { echo " checked="checked""; } ?> /></td> <td><p align='center'><input type="checkbox" name="dark[<?php echo $iii;?>]" value='1' <?php if($dp['dark']==1) { echo " checked="checked""; } ?> /></td> </tr> }?>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)