| | |
view employee info for the employee selected from the drop down list
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2006
Posts: 2
Reputation:
Solved Threads: 0
i have designed an employee details webpage. there is an option of generating pay slip. to do so all the information related to the employee and his/her salary has to be entered.
the employee details are already stored in the database. i want to design a form that will have a drop down list holding the employee names and some textboxes to hold the related information of the employee.
i want that when a employee name will be selected, the information related to that employee will be displayed in the respective textboxes.
please give a quick reaply with a code example.
thank you
the employee details are already stored in the database. i want to design a form that will have a drop down list holding the employee names and some textboxes to hold the related information of the employee.
i want that when a employee name will be selected, the information related to that employee will be displayed in the respective textboxes.
please give a quick reaply with a code example.
thank you
You could use something like this;
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
<select name="employee_name">
<option value="Employee 1">Employee 1</option>
<option value="Employee 2">Employee 2</option>
<option value="Employee 3">Employee 3</option>
</select>
</FORM
<?php
$employee_selected=$_REQUEST['employee_name'];
$query="SELECT * FROM employees WHERE employee='$employee_selected'";
$result=mysql_query($query);
$row=mysql_fetch_array($result, MYSQL_ASSOC);
// THEN YOU NEED THE TEXT BOXES
echo '<input name="employee_name" type="text" value="'.$row['employee_name'].'"/>';
?>
This script will get the employee name from the drop down, search the database and display the details you require in the respective textboxes.
I have a Customer/Employee management system on my website you could purchase if your stuck! I can totally customise it for you!
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
<select name="employee_name">
<option value="Employee 1">Employee 1</option>
<option value="Employee 2">Employee 2</option>
<option value="Employee 3">Employee 3</option>
</select>
</FORM
<?php
$employee_selected=$_REQUEST['employee_name'];
$query="SELECT * FROM employees WHERE employee='$employee_selected'";
$result=mysql_query($query);
$row=mysql_fetch_array($result, MYSQL_ASSOC);
// THEN YOU NEED THE TEXT BOXES
echo '<input name="employee_name" type="text" value="'.$row['employee_name'].'"/>';
?>
This script will get the employee name from the drop down, search the database and display the details you require in the respective textboxes.
I have a Customer/Employee management system on my website you could purchase if your stuck! I can totally customise it for you!
![]() |
Similar Threads
- Dropdown list in ASP.NET - How to get value selected (ASP.NET)
- Help with Drop Downs and Grid View (ASP.NET)
- Store and Retrieve Information (Java)
- search problem in vb (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: Syntax problem!
- Next Thread: is there something wrong with my SQL statement?
| Thread Tools | Search this Thread |
# .htaccess 5.2.10 access alexa apache api array beginner broken cakephp checkbox class clean clients cms code convert cron curl database date directory display dissertation dropdown dynamic echo$_get[x]changingitintovariable... email encode error fairness file folder form forms function functions google hack href htaccess html htmlspecialchars image include indentedsubcategory ip javascript joomla legislation limit link local login mail memberships menu methods multiple multipletables mysql mysqlquery network newsletters oop open passwords paypal pdf persist php provider query radio random redirect remote script search secure server sessions simple sockets source space spam sql system table tutorial upload url user variable video voteup web youtube





