how to remove information from the database when the page is refreshed

I’m doing this:

mysql_query("INSERT INTO `battle` (img,name,level,life,atk,def,type,username) SELECT img,name,level,life,atk,def,type,username FROM `enemy` ORDER BY RAND() LIMIT 1")or die(mysql_error());

But what’s the point? When you refresh the page, the info is entered again, can you do something so that only when you press the key, the info is entered? For example:
1. There is a Fightkey on the screen
2. In cases where we want to fight, we poke at it and we bring out the enemy
3. But the page is constantly updated and therefore info is constantly entered! Remove updates not mona =)

How can I make info pop up only when a key is pressed? Please elaborate if possibleThanks in advance

Answer 1, authority 100%

A unique key is made for each request. Those. here the script starts to work, some key is created and passed to the hidden field a la:

$secretkey = “jng93v”;


<input type=”hidden” value=”jng93v”>

When the request is executed, it checks if the key is being passed? He sees that the correct one and when the request is done he creates a new key, but the field remains the same old one. i.e.

$secretkey = “73f48b”;


<input type=”hidden” value=”jng93v”>

I.e. they no longer converge and the query will not be executed. I hope you understand my point.