On select of choice form drop down check database for ID then add 1 and use
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.
<?php $qw=mysql_query("select DISTINCT(Desc_Ame), Id_Ame from tbl_amenities group by Desc_Ame") or die (mysql_error());
echo "<option value='$r[Desc_Ame]' selected>$r[Desc_Ame]</option>";
echo "<option value='$r[Desc_Ame]'>$r[Desc_Ame]</option>";