I’m pretty new to PHP, so please forgive me if this question is obnoxiously noob…
I have a page that lists close to 150 records from a database. I want the user to only be able to delete one record at a time (no checkboxes). I want there to be a delete button next to each name, and when the user clicks it, the page refreshes with the updated list and success message above saying: “%Name% was deleted successfully”. (where %Name% is the actual name they deleted)
My question is: Can I do this with a form? If so, what form element would I assign the Name and delete button to?
Or, do I need to set the delete button as an anchor element, with the URL set to a page that can process the delete request, then redirects the user back (my concern there is the only way I can send the “Success” message back, that I know of is through a Session variable, is that ok?)
Or, is there some other way completely that I don’t know of?
Any feedback would be greatly appreciated.
Thanks
you can do it both way… here the key concept is having a unique field like id in the database for eg you have id,name,username and password field in database table so look at both the ways below
1. using hyperlink
this is what you do in listing page…. now look at delete.php which needs to be on the path as defined in hyperlink
delete.php
2. Using form
delete.php
(note: list.php is the page where you list all the info)