I have been searching this stuff but could not find anywhere.
when i search about button name and value, everywhere its mentioned about input type=button
But i am looking for button type=submit instead of input type=button
i want to allow users to remove their comments. So, the delete button is just showing like a link
The Html is
I am not getting how can i check if this button is clicked or not not using php as i tried
if(isset('delcom'))
{
$sql = "DELETE FROM comments WHERE id = :id";
$stmt = $DB->prepare($sql);
$stmt->bindValue(":id", $comid);
$stmt->execute();
}
?>
But its not working.
Meanwhile, i want a popup alert message that confirms Delete Query includings Delete or Cancel buttons on it
I don't want that simple javascript alert on the top of the page. I want some popup window in the middle of the screen with my own Color scheme
Please help
Answer
Make sure to get it from the POST
variable to check. This is probably what you're actually intending on doing.
if(isset($_POST['delcom']))
{
$sql = "DELETE FROM comments WHERE id = :id";
$stmt = $DB->prepare($sql);
$stmt->bindValue(":id", $comid);
$stmt->execute();
}
?>
No comments:
Post a Comment