In my page I have a bunch of instances where (using php) I have links sending to the same page with query strings (?action=x) so that when it sends to the same page at the beginning of the page it will see that _GET[action] isset and perform the desired action.
FOR EXAMPLE: Say you want to allow a user to delete a comment made at the end of one of their posts (on a blog). The way I learned to do it is to make the delete button a link to "currentpage.php?action=delete". Clicking the button will in a sense refresh the page where the page will see that _GET[action]=="delete" and run the code to delete the comment.
Is this the best way to do this? Is there not a way to make a click of a button cause code to run (in php) without having to refresh the page?
In addition to causing the user to lose their place in the page, there are certain cases when I won't know the actual page url and need to reference it (like if you have a "comments" function in a file that's required on each page so that you don't have to use the code to display the comments on every single page that has comments). So, I'd need a way to reference the current page in the link since I won't know it ahead of time. Is there a way to do that?
I apologize for not being clear enough earlier. Is this any better?