I have a form that contains a function. i want this function to be activated only when the user reposts the page to itself. (php_self).
ie. the user access the page and the function is hidden, the user then inputs data, repost the page and the function is activated.
I've tried flagging the function with a variable - $var = 0, then $var = 1 at the end of the page but $var just resets itself to 0 when the page is posted.
Sure this is simple but I just cant get it?
thanks
php_self posting problem
Moderator: General Moderators
Re: php_self posting problem
Code: Select all
if (!empty($_POST)) {
// do stuff after form has been submitted
}Re: php_self posting problem
Also mentioned recently, somewhere, is looking at the REQUEST_METHOD.
Code: Select all
if ($_SERVER["REQUEST_METHOD"] == "POST") {Re: php_self posting problem
YES!, thanks guys,
both of these work fine, I love a simple solution!
both of these work fine, I love a simple solution!