vendredi 4 septembre 2015

With all data array from database, how to create checkbox with enable\disable field with?

I want to create a table with question, checkbox and textbox. All question in database and i call them in array.Then, I create a disable textbox and will enable when checkbox is checked. So the problem is, how to make all checkbox and textbox can use the script in array, because the first row only has become as what i want and the rest row does not apply it. Why? Please help me. I appreciate it. I hope you understand my question because Im not good in english.

Above is my javascript. This java work perfectly. Below is my php and html. Please help me

<?php
$query1 = mysql_query("SELECT * FROM ftrquestion ORDER BY ID") or die("could not search!");
    $count1 = mysql_num_rows($query1);

    if ($count1 = 0){
        $output = 'Theres was not search result !';
        } else {
        while ($row1 = mysql_fetch_array($query1)) {
            $ID = $row1['ID'];
            $MCPA = $row1['MCPA'];
            $quesDescBM = $row1['quesDescBM'];
            $quesDescBI = $row1['quesDescBI'];
            ?>

            <tr height="55px">
            <td ><center><?php echo $ID ?></center></td>
            <td ><?php echo $MCPA ?></td>
            <td ><span class="BM"><?php echo $quesDescBM ?>  </span> <span class="BI"><?php echo $quesDescBI ?> </span></td>
            <td ><a href=#><img src="images.png"></td>
            <td><input type="checkbox" id="checkservice<?php $ID ?>" name="checkservice>"></td> 
            <td><input type="text" id="txtpercent<?php $ID ?>" name="txtpercent"  size="1" maxlength="3" disabled> </td>
            </tr>
            <?php
            }
        }
?>




Aucun commentaire:

Enregistrer un commentaire