Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to hide table row?

I am trying to hide the table row for user_id. I only want to show the full name, user name, and actions in the table. I tried to remove the code for the user id row, but it affected the other functionalities like the edit and delete.

here is the code:

<form method="post" id="editForm"> 
    <table class="table">
        <tbody>
        <tr>
                <th scope="col">USER ID</th>
                <th scope="col">FULL NAME</th>
                <th scope="col">USER NAME</th>
                <th scope="col">ACTIONS</th>
        </tr>
        
        <?php $a = 0?>

        <?php while ($row = mysqli_fetch_array($res)) { 

            echo "<tr id=".$a++.">
                <th scope='row' class='row-data'>".$row['user_id']."</th>
                <td class='row-data'>".$row['full_name']."</td>
                <td class='row-data'>".$row['user_name']."</td>
                <td><input type='button' 
                        value='EDIT'
                           onclick='editUser()'' /></td>
                <td><input type='button' 
                         value='DELETE' 
                   onclick='deleteUser()' /></td>
            </tr>
        
        </tbody>";
       }; ?>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Instead of removing the column, you can set the display style to ‘none’ for this column

(add style="display:none;")

Hence (1) change

<th scope="col">USER ID</th>

to

<th scope="col" style="display:none;">USER ID</th>

and (2) change

<th scope='row' class='row-data'>".$row['user_id']."</th>

to

<th scope='row' class='row-data' style="display:none;">".$row['user_id']."</th>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading