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">
                <th scope="col">USER ID</th>
                <th scope="col">FULL NAME</th>
                <th scope="col">USER NAME</th>
                <th scope="col">ACTIONS</th>
        <?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' 
                           onclick='editUser()'' /></td>
                <td><input type='button' 
                   onclick='deleteUser()' /></td>
       }; ?>

>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>


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

and (2) change

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


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

Leave a Reply