How to Implement search option in PHP

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 64
Joined: Thu Mar 14, 2013 6:10 am

Mon Aug 19, 2013 4:29 am

How to Implement search option in PHP

I want to load employee details once his employee ID is entered in Textbox and user press Enter key, how can I implement such a thing in PHP

User avatar
New php-forum User
New php-forum User
Posts: 44
Joined: Tue Feb 26, 2013 6:00 am
Location: Mindfire Solutions

Tue Aug 20, 2013 11:50 am

You can create a form like
<form action='get_employee_details.php' method='post'>
<input type='text' name='employee_id' />
<input type='submit' name='submit' value='submit' />

then when user enter the id in text box and click submit it will go to employee_detail.php and post the form values in that page.

so in employee_details.php you can write
$empId = mysql_real_escape_string($_POST['employee_id']);

/*then you can use this $empId value to get the result either from database or array or any storage where you are saving the employee_details and load on the browser whatever format you prefer */

Sandeep Agrawal
Mindfire Solutions

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests