I have a drop down that is automatically generated using PHP, and basically what I need to happen is on selection of a ceratin one to go to the database and check the latest id associated with that category and the use that ID add 1 to it, and then when the user updates the database, the new ID is associated with that entry.

I was htinking that AJAX might be the best option for it.

Here is what I got so far.

Code:
<
select name="txtdesc">
<?php $qw=mysql_query("select DISTINCT(Desc_Ame), Id_Ame from tbl_amenities group by Desc_Ame") or die (mysql_error());
while($r=mysql_fetch_assoc($qw))
{
if($r['Desc_Ame']==$desc)
{
echo "<option value='$r[Desc_Ame]' selected>$r[Desc_Ame]</option>";
}
else
{
echo "<option value='$r[Desc_Ame]'>$r[Desc_Ame]</option>";      
}
}
?>