you can achive this very easily ,
i usually do like this.
i create a seperate table for Department.and save all my department names in that.
when i want to give the modify option to the user.it should populate all these values to the drop down menu.the value he already selected will be the selected value.
here is an example,
<?php
$result=mysql_query("select name,age,dept_name from usertable where username='shiju',$con);
//query for displaying your user information.
$row=mysql_fetch_array($result);
$result1=mysql_query("select dept_name from depertament",$con);
//Query for populating all the department name to the drop down menu.
?>
<select name="dept">
<?
do{
if($sec_query_row["dept_name"]!= $row["dept_name"]){
echo "<option value=".$sec_query_row["dept_name"].">".$sec_query_row["dept_name"]."</option>";
// if dept name is already not selected then simply populate values to the drop down(ie, values that is not selected).
}else{
//else if it is selected then populate to the drop down menu and make it as selected.
echo "<option value=".$row["dept_name"]." selected>".$row["dept_name"]."</option>";
}
}while($sec_query_row=mysql_fetch_array($result1));
// Rotate the loop till popualting all the values to the drop down.
?>
</select>
#######-- This will solve your problem.i normally do like this. But you can save all the department names in an array and do same kind of action.
#################-------#################
One advantage using table is that you can update that table any time and that will populate value to the drop down menu insetead of changing the array value in your script.
################--------
i hope you have understood the logic.if any problem tell me here!!
Good Luck!!
------------------
SR -
shiju.dreamcenter.net
"The fear of the LORD is the beginning of knowledge..."
[This message has been edited by Shiju Rajan (edited May 31, 2000).]