Edit button, delete in a list made in HTML?

Asked

Viewed 819 times

1

I know that it is much easier to use framesworks and specific technologies for web development like Angular.JS, ZEND, Java EE, etc. But I am developing a CRUD system using the minimum of "facilities" possible.

For a system using only Javascript and PHP programming languages what would be the best practice to associate the Edit and Delete button to your corresponding record? I had the idea of putting a column of Code on the list screen for each record, and so when clicking on one of the buttons, we take the code of the record that is in the same row of the HTML TABLE (using JS), but this would be a good practice? would have other ways of doing that?

CRUD

  • Can you put the value="id do registro" on the button, so you can recover this value by Javascript. Some programmers also put a link on the button of a page that is waiting for the id by the method get, the link would look like this: suaPagina.php?id=*id do registro*.

  • It depends on a few things; for example, where do you want to send the code by clicking "Edit" and "delete"? Send it to a function? Send to another page?

  • The ideal would be to bring the records via a select if this information is connected to a database and the edit button is connected to an update command as much as the delete is connected to the delete command

  • @In order to send to a file . php, which will contain a function responsible for executing a DELETE in the database.

  • But is this via Ajax or are you going to redirect? You can put the code of each record directly on the button, without having to use JS for this, no?

  • I intend to make a redirect. I didn’t have this idea to generate the buttons with a value linked to the code in the database, already mentioned by @Laérciolopes.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.