I want to remove an item from dropdown list with php. but it does not remove an item.
This is the html part.
<form action="dashboard_delete_post.php" method="post">
<div class="post_lable_and_text">
<label class="title_style_lable" >Post Title </label>
<select>
<?php show_Post_Content(); ?>
</select>
<button class="btn_post" type="submit" name="delete">Delete</button>
<?php delete_Post_Content(); ?>
</div>
</form>
This is the php code snippet in the hope of removing an item via dropdown list.
function delete_Post_Content() {
global $db_link;
if (isset($_POST['delete'])) {
$post_Id = $_POST['post_id'];
$post_Title = $_POST['post_title'];
$removeSqlData = " DELETE FROM posts WHERE post_id = '$post_Id' ";
$result = mysqli_query($db_link, $removeSqlData);
if (!$result) {
echo "error!";
}
}
}
Is there any issue with this?