I am programming this backend for the administrator of a website. I am not so experienced so sometimes i get these stupid doubts. I got to a point in wich the user gets a list of items layed out in a table. now i want to add a column with one delete link for row. whats the best way? passing the row id throght GET? throgh post? if i use post i have to use a form for each row right? Any other solutions?
you can use a normal link <a href="">Delete Row</a> to delete a row, just add the unique id to the link string. Eg => echo "<a href=\"delete.php?id=$id\">Delete Me</a>"; Voila
One thing I can say about using URLs to do this: if any of your users have a browser that 'prefetches' links on a page, you can be in real trouble! Imagine an admin that has that list, with all of the appropriate delete links. Now imagine their browser tries to be helpful by following all of the links in the background, ready to display... If you use a URL, make sure that there's some kind of interactivity like going to a page that displays an 'Are You Sure?' button. Alternatively, make the links link to a JavaScript function that asks that. Anyway, that's just something to keep in mind! Even not thinking about that, it's kind of 'wrong' doing it that way, anyway. History (if not specifications) dictate that GET requests don't make changes on the server while POST requests do.