Here goes......
Try to explain it the best I could....
<?php
if ($_POST[state]=="deleteheader")
{
//build connection with localhost
//connect to db
mysql_query("DELETE FROM header WHERE headerId='$_POST[cat]' ");//delete from db
CreateList();
}
//inside the function creating drop-down list
function CreateList(&$name_of_dropdown)
{
$resultId=mysql_query("SELECT headerId FROM header",$link);
print "<select name=\"$name\" id=\"$name\">";
print "<option value=\"No Headers\" selected>No Headers</option>";
while ($row=mysql_fetch_row($resultId))
{
foreach ($row as $field)
{
print "<option value=\"$field\">$field</option>";
}
}
}
?>
//suppose CreateList(&$name_of_dropdown) at the moment produce:
-Apple
-Banana(selected by user)
-Orange
//then the user click 'Delete' button:
<form action="<?php $PHP_SELF ?>" enctype="multipart/form-data" method="post">
<INPUT TYPE="HIDDEN" NAME="state" value="deleteheader">
<INPUT TYPE="HIDDEN" NAME="cat" value=" <?php print \"$name_of_dropdown\"; ?> ">
<input type="submit" value="Delete">
</form>
//after the processing is done the 'Banana' is still there.....