Is it secure to use GET parameters to delete data in PHP, as mentioned in the forum thread?
Using GET parameters to delete data in PHP is not secure as it exposes the deletion action directly in the URL, making it vulnerable to CSRF attacks or accidental deletion. To solve this issue, you should use POST requests for actions that modify data, such as deletions.
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['delete'])) {
// Perform deletion action here
}
?>
```
In your HTML form:
```html
<form method="post">
<input type="hidden" name="delete" value="1">
<button type="submit">Delete</button>
</form>