A
A
Andrey Elsukov2020-05-15 06:19:03
PHP
Andrey Elsukov, 2020-05-15 06:19:03

"delete" button?

Hello! I'm just learning web development.

Now the following task has appeared:

There is an admin panel, where adding an article and displaying all articles through a foreach loop.
Each article has a delete button (I know, it’s not very good to make a button through a link) The

question is: how to make the button, when it is clicked, send the id of the post in which it was clicked to the executable file, which will delete this entry.

Like I said, I'm just learning. Therefore, maybe even my idea is wrong. Tell me what's the best way to do it?

Thank you all very much for your reply

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shenter, 2020-05-15
@Dropsen

Do you have the id of this post in some variable?
Then just

<a href="deletepost.php?article_id=<?php echo $id; ?>"

Of course, deletepost.php should check permissions, the presence of this article, and so on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question