moondance
09-10-2003, 09:42 AM
Here's what i'm trying to do:
One php file with 4 functions, each with a location of PHP_SELF. The functions that run depend on variables set, so at the top of the page there are if loops ie:
//from form
if ($_POST['search')]{
search();
}
//from clicking on link
if ($_GET['All']){
Find_All();
}
What i can't get my head around is if i run one function, i want i to set a variable, so that when the page reloads for a different function using PHP_SELF, it can see that that variable is set so will perform a slightly different task.
So for instance:
Function search()
{
if (isset($_POST['globalvar'])){
one kind of search
}else{
another kind of search
}
}
I'm sure this would invlove using global variables but its not working. I've set the global variable with all my other variables
$globalvar = "somevalue"
Then in the function i want this value to change i've got:
global $globalvar;
$globalvar = "True"
So when the page is reloaded, $globalvar should ouput true. If it does, well, see the example above. But its not happening.
arrgh i been trying this all day and me heeds throbbing.
One php file with 4 functions, each with a location of PHP_SELF. The functions that run depend on variables set, so at the top of the page there are if loops ie:
//from form
if ($_POST['search')]{
search();
}
//from clicking on link
if ($_GET['All']){
Find_All();
}
What i can't get my head around is if i run one function, i want i to set a variable, so that when the page reloads for a different function using PHP_SELF, it can see that that variable is set so will perform a slightly different task.
So for instance:
Function search()
{
if (isset($_POST['globalvar'])){
one kind of search
}else{
another kind of search
}
}
I'm sure this would invlove using global variables but its not working. I've set the global variable with all my other variables
$globalvar = "somevalue"
Then in the function i want this value to change i've got:
global $globalvar;
$globalvar = "True"
So when the page is reloaded, $globalvar should ouput true. If it does, well, see the example above. But its not happening.
arrgh i been trying this all day and me heeds throbbing.