vendredi 1 septembre 2017

Why PHP affect on JavaScript Code?

Please I need to know why when i put javascript code in html and php code it won't work? For example in the following code i retrive some data from database using CodeIgniter framework and i need to put Javascript function which select all checkboxes in the table row when the user press select all checkbox but all of the example of javascript code i found on the internet tutorials can't be excuted for unknown reason

                foreach($system_perms as $row)
                {
                ?>

                <tr>
                    <td style="font-size:16px;font-weight:800"><?php echo $row->RoleNameEn ?></td>
                    <td style="font-size:16px;font-weight:800">
                    <input type="checkbox" name="all_perms_<?php echo $row->RoleNameEn; ?>" /></td>

                    <td style="font-size:16px;font-weight:800"><?php
                    echo $SectionNameEn;
                    ?></td>

                    <td style="font-size:16px;font-weight:800">
                    <input  type="checkbox" name="View_<?php echo $row->RoleNameEn ?>" id="View">
                    </td>
                    <td style="font-size:16px;font-weight:800">
                    <input  type="checkbox" name="AddNew_<?php echo $row->RoleNameEn ?>" id="AddNew">
                    </td>
                    <td style="font-size:16px;font-weight:800">
                    <input  type="checkbox" name="Edit_<?php echo $row->RoleNameEn ?>" id="Edit">
                    </td>
                    <td style="font-size:16px;font-weight:800">
                    <input  type="checkbox" name="DeleteItem_<?php echo $row->RoleNameEn ?>" id="DeleteItem" >
                    </td>
                    <td style="font-size:16px;font-weight:800">
                    <input  type="checkbox" name="Print_<?php echo $row->RoleNameEn ?>" id="Print">
                    </td>
                    <td style="font-size:16px;font-weight:800">
                    <input  type="checkbox" name="Search_<?php echo $row->RoleNameEn ?>" id="Search">
                    </td>



                </tr>

            <?php
            } 
            ?>

this code for permissions system .. all my needs is when the user press on all permissions checkbox, javascript function select all checkboxes like view, addnew, edit, delete, search, print

any idea would be appreciated.




Aucun commentaire:

Enregistrer un commentaire