siwelis Posted May 27, 2007 Share Posted May 27, 2007 I'm trying to call the function from page1 while in page 2, passing information to be put where the function is located in Page1. I hope I'm being clear with this. Does anyone know how to write this? PAGE1.PHP function Page2Content(){ echo $contentfromPage2; } PAGE2.PHP include $_SERVER['DOCUMENT_ROOT'].'/PAGE1.PHP'; Page2Content(){ $contentfromPage2 = $_POST['testpost']." ".$_POST['testpost2']; } Quote Link to comment https://forums.phpfreaks.com/topic/53217-passing-information-to-functions/ Share on other sites More sharing options...
radi8 Posted May 28, 2007 Share Posted May 28, 2007 Unless I am missing something, the only way to reference the funcions on a page is to have the include(page) at the beginning of each page. I would do this differently if possible, create a php file that holds all of your functions, and then just include that one file onto each page (include("functions.php")). They are always available then. Quote Link to comment https://forums.phpfreaks.com/topic/53217-passing-information-to-functions/#findComment-262959 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.