I'm building a form with a submit button in PHP. When the button is pressed, I use $PHP_SELF to go to the same page, and use an IF statement to see if there is a value in the button's name variable. If so, the button has been pressed and the SQL under that if is excecuted. If not, the form itself is displayed.
However, after pressing the button, and when I'm on the page that has executed the SQL (in this case adding an entry to the database), if I click the Refresh button the browser, the same SQL statement is executed. I assume this is because there is still a value in the button's name variable.
Is there any way to get away from this? I'd like a Browser Refresh to clear out that variable and bring me (or the user) back to the else statement with no value in that button.
Thanks. 🙂