PHP Pro’s I need help.
Is there a way to only execute a function once another function has been executed?
For security reasons I cannot show you my code but I can give you an example of what I am doing.
[code=php] function mailForm($elements){
/*do something*/
header(‘Location: blah.php’);
}
if(isset($_POST[‘form’]) && $_POST[‘form’]==1) {
$elements = array($_POST[‘something’]);
mailForm($elements);
/*In the function above there is a script that returns you to a page if an error is found in the form validation*/
/*However because the PHP scripts execute the functions at the same time (I think!) it does not take you back to the page until it has executed the following function*/
$elementsPartTwo = array($_POST[‘something’]);
mailForm($elementsPartTwo);
}
I think that this is a very simple problem and I am just being stupid but everything I have tried has not worked.
Thanks in Advance,
Ben