Firstly, I'm no expert, just learning as well myself so maybe somebody else can add in here.
Secondly, I think users normally don't know their id so usually it is not a good search tool. If you already know the id, then no search is needed.
Thirdly, a search for first name alone and even first name and last name is not all that specific -- you could have more than one user with the same name.
But you could make a form for the entry of the name you want to search. This is the general gist of it, I'm probably missing a good few things here so
you will need to fill it out with validation and all that stuff:
So something like:
<form method="POST" action="">
<input type="text" name="search_firstname" value="">
<input type="text" name="search_lastname" value="">
<input type="submit" name="submit" value="search">
</form>
// further down then, you could run a query to the database to find the details for that name.
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
// I haven't time to add validation, you will need to do that yourself.
$firstname = $_POST['search_firstname'];
$lastname = $_POST['search_firstname'];
$q ="SELECT * FROM rcrentals WHERE firstname = '$firstname' AND lastname = '$lastname' ";
$r = @mysqli_query ($link_to_database, $q);
$data = mysqli_fetch_all($r);
echo ' <p> My search reveals that you live in' . $data[0]['city'] . '</p>';
}