mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-08-04 02:04:53 +02:00
Add User Search Bar
This commit is contained in:
parent
8c206ba1f8
commit
34f904ccc4
3 changed files with 140 additions and 3 deletions
21
system/controllers/search_user.php
Normal file
21
system/controllers/search_user.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
$query = isset($_GET['query']) ? trim($_GET['query']) : '';
|
||||
|
||||
if (!empty($query)) {
|
||||
$results = ORM::for_table('tbl_customers')
|
||||
->where_like('username', "%$query%")
|
||||
->find_many();
|
||||
|
||||
if ($results) {
|
||||
echo '<ul>';
|
||||
foreach ($results as $user) {
|
||||
echo '<li><a href="'.$_url.'?_route=customers/view/'.$user->id.'">' . htmlspecialchars($user->username, ENT_QUOTES, 'UTF-8') . '</a></li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
} else {
|
||||
echo '<p>' . Lang::T('No users found.') . '</p>';
|
||||
}
|
||||
} else {
|
||||
echo '<p>' . Lang::T('Please enter a search term.') . '</p>';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue