tags:

views:

123

answers:

2

If the user manually clicks the 'submit' button, i use this code:

if (isset($_POST['submit_findall'])) { ...

But what what code should I use if I want to activate this from within a script ?

Thanks!

A: 

Change:

if (isset($_POST['submit_findall'])) { 
    // Something
}

to:

// Something
David Dorward
yes, but I don't want to duplicate the code, i.e. it should be working both on button press, as well as activated from within the script.
Pressing the button will cause the script to be reloaded, so you don't need to duplicate the code; just change it as above.
David Dorward
What does "activated" by a script mean? If you need to call code twice, just push it into a function and call the function twice.
Till
yes, thanks, already made it into a function! :)
+2  A: 

if($_SERVER['REQUEST_METHOD']=='POST') is bullet proof indicator of the POST form submit

Col. Shrapnel
guess I figured how it should work, I have to use a function...