Your <select>
element should be within a <form>
element. (by the way you should rename your select element from Id
to id
as you are expecting Id
in your PHP block. You can also change if block to check $_POST['id']
instead of $_POST['delete']
)
Then, you should submit this form either via javascript or with a submit button.
BTW: You better cast posted id to integer to prevent sql injection