如何显示表格数据,当我在文本框中输入用户名时,只显示带有相应字母的用户名

I have some code that at the moment, upon the page load up, doesn't display my table data, and when I type in a username into my text-box, it displays the data corresponding with the letters typed into the text-box to match the username characters.

I want it to automatically show my table data and make the username search optional, only display certain users when typed into the text-box.

My current code is below :

index.php

<form name="bulk_action_form" action="" method="POST"/>
<?php 
    if(isset($_POST['bulk_delete_submit'])) {
        if(!empty($_POST['checked_id'])) {
            $idArr = $_POST['checked_id'];
            $username = $_SESSION['username'];
                foreach($idArr as $id) {
                    mysqli_query($con, "DELETE FROM `users` WHERE `id` = '$id' AND `username` = '$username'");
                    echo "<p>".$id ."</p>";
                }
            $_SESSION['success_msg'] = 'Users have been deleted successfully.';
            header("Location: admin_members.php");

        } else { 
            echo '<div class="row" style="color: red; text-align: center; padding-bottom: 20px;"><i class="fa fa-spin fa-spinner"></i> You must select atleast one user to delete <i class="fa fa-spin fa-spinner"></i></div>';
        }
    }
?>

<div class="row">
<div class="card-box" style="border-radius: none; padding: 10px; border: 1px solid #E3E3E3; background: #EEEEEE;">
<button type="submit" class="btn btn-danger" name="bulk_delete_submit"><i class="fa fa-trash-o"></i></button>
</div>
</div>
<div id="result"></div>
    </div>
</form>

(Ignore the , the result div is the main part, at listed for my JS code below).

JS in index.php

<script>  
 $(document).ready(function(){
      $('#search_text').keyup(function(){  
           var txt = $(this).val();  
           if(txt != '') {  
                $.ajax({  
                     url:"search.php",  
                     method:"post",  
                     data:{search:txt},  
                     dataType:"text",  
                     success:function(data)  
                     {  
                          $('#result').html(data);  
                     }  
                });  
           } else {  
                $('#result').html('');                 
           }  
      });  
 });  
 </script>  

And then for my search.php

 <?php 
 include_once('configuration/db.php');
 ?>

    <div class="table-responsive">
    <table class="table m-0">
    <thead>
    <tr class="gradeA">
    <th><input type="checkbox" id="selectall"/></th>
    <th style="text-align: center;">Username</th>
    <th style="text-align: center;">Email</th>
    <th style="text-align: center;">CPUKey</th>
    <th style="text-align: center;">IP</th>
    <th style="text-align: center;">Expirey</th>
    <th style="text-align: center;">Enabled?</th>
    <th style="text-align: center;">Profile Picture</th>
    <th style="text-align: center;">User Level</th>
    <th style="text-align: center;">Date/Time Registered</th>
    <th style="text-align: center;">Account Credits</th>
    <th style="text-align: center;">Free Gifted Credits</th>

    </tr>
    </thead>
    <tbody>
    <tr>
    <?php
    $username = $_SESSION['username'];
    $clients_result = mysqli_query($con, "SELECT id, username, email, cpukey, ip, time, enabled, profile_picture, userLevel, register_time, account_credits, free_gifted_credits FROM users WHERE username LIKE '%".$_POST["search"]."%'");
    if(mysqli_num_rows($clients_result) > 0) {
    while($payment_row = mysqli_fetch_array($clients_result)) {
    echo '                  
    <tr style="text-align: center; font-size: 12px;">
    <td>
    <input type="checkbox" name="checked_id[]" class="checkbox" value='.($payment_row['id']).'>
    </td>
    <td>
    '.($payment_row['username']).'
    </td>
    <td>
    '.($payment_row['email']).'
    </td>
    <td>
    '.$payment_row['cpukey'].'
    </td>
    <td>
    '.($payment_row['ip']).'
    </td>
    <td>
    <b>'.$payment_row['time'].'</b>
    </td>
    <td>
    '.($payment_row['enabled'] == 1 ? '<span class="label label-success">Yes</span>' : '<span class="label label-danger">No</span>').'
    </td>

    <td>
    '.("<img src=".$payment_row['profile_picture']." alt='user-img' class='img-circle user-img' style='height: 20px; width: 20px;'>").'
    </td>
    <td>
    '.userLevelValidation().'
    </td>
    <td>
    '.$payment_row['register_time'].'
    </td>
    <td>
    '.number_format($payment_row['account_credits'], 2, '.', '').'
    </td>
    <td>
    '.number_format($payment_row['free_gifted_credits'], 2, '.', '').'
    </td>
    ';
    ;
         } }else{ ?> <tr><td colspan="12" style="text-align: center; padding: 30px; letter-spacing: 2px; color: red;"><i class="fa fa-spin fa-spinner"></i> <strong>Oh snap!</strong> No Purchase records found. <i class="fa fa-spin fa-spinner"></i></td></tr> <?php } ?>

    </tr>
    </tbody>
    </table>
    </div>

<script type="text/javascript">

$('#selectall').click(function() {
    $(this.form.elements).filter(':checkbox').prop('checked', this.checked);
});

</script>

Any help would be much appreciated.