User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 422,812 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,358 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1211 | Replies: 1
Reply
Join Date: Nov 2006
Posts: 2
Reputation: fariba123 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
fariba123 fariba123 is offline Offline
Newbie Poster

Help view employee info for the employee selected from the drop down list

  #1  
Nov 28th, 2006
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2006
Location: South Wales
Posts: 159
Reputation: phper is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 11
phper's Avatar
phper phper is offline Offline
Junior Poster

Re: view employee info for the employee selected from the drop down list

  #2  
Dec 2nd, 2006
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!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 10:02 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC