Hi,

How to create a dynamic drop down list using php. My drop down list should be:

Example:
if manager logins : the manager should see only the manager list of a company.
if employee logins: the employee should see only the employee list of a company.

Please help me out....

Recommended Answers

All 6 Replies

Below is not a complete code,it is just a logic.
Try to implement at your end.

<select name="dropd" id="dropd">
<option value=""> - - Select - -</option>
<? 
if(manager is logged in)
{
	$res = select manager list from database
	while($rs = mysql_fetch_assoc($res))
	{
?>
	<option value="<?=$rs['manager-id']?>"><?=$rs['manager-name']?></option>
<?
	}
}
if(employee is logged in)
{
	$res = select employee list from database
	while($rs = mysql_fetch_assoc($res))
	{
?>
	<option value="<?=$rs['employee-id']?>"><?=$rs['employee-name']?></option>
<?
	}
}
?>
</select>

hi...thanks for your coding and for your clear explanation.

hi folks .. im new to daniweb and i like to learn more bout php .. since im preparing for my thesis in the future please do help me code just a simple horizontal menu (not a hyperlink) and when you navigate or point your cursor in that menu, the submenus will automatically revealed and is vertically presented .. please do help me .. Godbless

Start a new discussion and don't post new questions here.

Start a new discussion and don't post new questions here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.