Hi,
I need to get the itemId's from the Database to a combo box where the combo box will increase according to the new values.
I wrote a code like this
<select name="catId">
<?php
//get category id from the database
$sql = "SELECT cat_id FROM tbl_category ORDER BY cat_id";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
echo "<option value=\"".$row['cat_id']."\">".$row['cat_id']."</option> \n ";
}
?>
</select>
With that I could have taken the item id and the other necessary values displayed according to the id.But the problem is even though it displayed correct values ,always the item id which is selected is the first one.So I cant do any update with it,because it will update only the 1st record in the DB table since update query is working according to the itemId.How should I change the code to get the correct item id selected with its values displayed in the form where I can edit and update it.
Please help me..