-3
I want to run a PHP code with the button Submit. The problem is that every time I refresh the page, the code runs again. I used this:
  if (isset($_POST['carregar'])) {
      // pedaço de código...
  }
And the button:
echo "<form method=POST action=#>";
echo "<input type=submit name=carregar value=Carregar>";
echo "</form>";
and what’s the problem?
– Jorge B.
Every time I refresh the page, it rerun the code, even without clicking the button.
– akm
You have to do as I told you in this answer http://answall.com/a/40158/7210
– Jorge B.
Right and how I identify the name of the button?
– akm
doings
if(isset($_POST['carregar']))within theifof that answer.– Jorge B.
if (filter_input(INPUT_SERVER, 'REQUEST_METHOD') === 'POST') { if(isset($_POST['load'])){
– akm
Still the problem, @akm?
– felipe.zkn
If I were you, I’d start thinking about using Ajax
– Guilherme Nascimento