I would like to delete a row from mysql database. The row I would like to delete is the 'selected item' in the combobox.
My code so far:
$sql = "SELECT data_id FROM projects";
$result = mysql_query($sql);
echo "<select name='data_id '>";
echo "<option selected>Please select...</option>";
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['data_id '] . "'>" . $row['data_id'] . "</option>";
}
echo "</select>";
?>
<tr><td><input type="submit" name="delete" value="Delete" id="delete"></td></tr></tr></table>
<?php
//delete selected item from projects table...
?>
The combobox is showing all the items from my projects table. When I select an item, then click on 'delete' I would like to delete that item from the table.
Any help will be appreciated.