How do you delete variables before refreshing page?

A

Anonymous

Guest
I have a problem with a page im building, i have a list of records with an 'X' on the page, you click the X and it deletes the last record on the page, the query string i use is 'page.php?action=delete' and it works fine, you click it and the page refreshes with the last record gone.
But, when you manually refresh the page with the refresh button it also deletes the last record.
How do i stop it deleting the last record when you manually refresh the page? it obviously is keeping the 'action' variable and passing it back into the page when you refresh it and i dont want that unless you click on the X.
 
I would also include a specific record that you want to delete.

page.php?action=delete&record=24

and set the query like this.

Code:
$query = 'delete form table where id = "'.$_GET['record'].'"';
if there is not record at id 24 then it will not delete anything. so it will only delete something on it's first attempt. remember in your database you should have an auto_incremention field as your primary index which if one is deleted there will never be another with the same index number.
 
wasnt quite as simple as that, i found a solution, i used at the end of the function header("Location: page.php") and it worked perfect.
 
Back
Top