victorrr
Packet Sniffer
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
500 XP
If you are looking for a source code for Search Record System In PHP then you are at the right place. This is a simple program using PHP and MySQL for searching record in the database.
This program contains a TextBox where the user entering the keyword and button to generate searching and table to show the information. And, the user can search in the TextBox by FirstName, LastName, or ID Number.
Form Input Field - HTML
This HTML Form input field where the user types the keyword for search.
Showing Results
This source code where the information display.
And, this is the database script.
Output:
This is the result if the user found the information in the database.
And, this is the result if the user did not found the information in the database.
So what can you say about this work? Share your thoughts in the comment section below or email me at [email protected]. Practice Coding. Thank you very much.
Download
This program contains a TextBox where the user entering the keyword and button to generate searching and table to show the information. And, the user can search in the TextBox by FirstName, LastName, or ID Number.
Form Input Field - HTML
This HTML Form input field where the user types the keyword for search.
- <form
method
=
"post"
action
=
""
name
=
"form1"
id
=
"form1"
>
- <p
style
=
"font-size:18px; margin-left:100px;"
>
- Type the First Name, Last Name, or ID Number of the User
- </
p
>
- <br
/
>
- <p
style
=
"font-size:18px; margin-left:100px;"
>
Search User <input
type
=
"text"
autofocus=
"autofocus"
name
=
"search_file"
id
=
"search_file"
style
=
"width:230px; font-size:18px;"
class
=
"textboxclass"
/
>
- <input
type
=
"submit"
style
=
"font-size:18px; margin-top:-9px;"
class
=
"btn btn-primary"
name
=
"submit"
value
=
"Filter"
></
p
>
- </
form
>
Showing Results
This source code where the information display.
- <div class="container">
- <div class="alert alert-success"><center> <h4>Record Results </h4></center> </div>
- <br />
- <table class="table table-striped">
- <thead>
- <tr>
- <th class="text-center">No.</th>
- <th class="text-center">FirstName</th>
- <th class="text-center">LastName</th>
- <th class="text-center">Phone Number</th>
- <th class="text-center">Email Address</th>
- </tr>
- </thead>
- <tbody>
- <?php
- error_reporting
(
0
)
;
- if
(
$_REQUEST
[
'submit'
]
)
{
- $search_file
=
$_POST
[
'search_file'
]
;
- $sql
=
mysql_query
(
"select * from information where firstname like '%$search_file
%' o
r lastname like '%$search_file
%' or ID like '%$search_file
%' Order by lastname ASC"
)
or die
(
'Error in query : $sql. '
.
mysql_error
(
)
)
;
- if
(
empty
(
$search_file
)
)
{
- echo
'<script language="javascript">'
;
- echo
'alert("Text field cannot be empty. Please Try it again.")'
;
- echo
'</script>'
;
- header
(
"refresh:2; url=index.php"
)
;
- }
- else
if
(
mysql_num_rows
(
$sql
)
>
0
)
- {
- $i
=
1
;
- while
(
$row
=
mysql_fetch_array
(
$sql
)
)
{
- // Print out the contents of the entry
- echo
'<tr>'
;
- echo
'<td class="text-center">'
.
$i
.
'</td>'
;
- echo
'<td class="text-center">'
.
$row
[
'firstname'
]
.
'</td>'
;
- echo
'<td class="text-center">'
.
$row
[
'lastname'
]
.
'</td>'
;
- echo
'<td class="text-center">'
.
$row
[
'phonenumber'
]
.
'</td>'
;
- echo
'<td class="text-center">'
.
$row
[
'email'
]
.
'</td>'
;
- $i
++;
- }
- }
- else
- {
- echo
'<div class="alert alert-danger" style="width:130px; float:right; margin-top:-142px;">No Results Found!!!</div>'
;
- }
- }
- ?>
- </tbody>
- </table>
- </div>
And, this is the database script.
- <?php
- mysql_select_db
(
'users'
,
mysql_connect
(
'localhost'
,
'root'
,
''
)
)
or die
(
mysql_error
(
)
)
;
- ?>
Output:
This is the result if the user found the information in the database.

And, this is the result if the user did not found the information in the database.

So what can you say about this work? Share your thoughts in the comment section below or email me at [email protected]. Practice Coding. Thank you very much.
Download
You must upgrade your account or reply in the thread to view hidden text.