fareedreg Posted January 22, 2010 Share Posted January 22, 2010 if we are including a file like (include 'call.php')... in pass.php...can we pass a variable value to call.php from pass.php at the same time. so we can access it at call.php example below... //pass.php $id=1; include 'call.php'; Quote Link to comment https://forums.phpfreaks.com/topic/189454-passing-value/ Share on other sites More sharing options...
laffin Posted January 22, 2010 Share Posted January 22, 2010 Yes, all pass.php global variables and functions will be accessible from cell.php Quote Link to comment https://forums.phpfreaks.com/topic/189454-passing-value/#findComment-1000033 Share on other sites More sharing options...
fareedreg Posted January 22, 2010 Author Share Posted January 22, 2010 Yes, all pass.php global variables and functions will be accessible from cell.php but it is not .. see code //call.php <?php $cnt=$_GET['id']; ?> //pass.php $id=1; include 'call.php'; Quote Link to comment https://forums.phpfreaks.com/topic/189454-passing-value/#findComment-1000039 Share on other sites More sharing options...
wildteen88 Posted January 22, 2010 Share Posted January 22, 2010 You don't use $_GET, you use the actual variable name $id To learn more about include read up on the manual http://php.net/manual/en/function.include.php Quote Link to comment https://forums.phpfreaks.com/topic/189454-passing-value/#findComment-1000043 Share on other sites More sharing options...
jl5501 Posted January 22, 2010 Share Posted January 22, 2010 Any php file included in another php file is treated as part of the same file at execution time. so you would read and write your variables exactly as if you were coding in one file. You only pass variables in $_GET when the variables are set in the url string of the page being loaded, like a form being submitted with method="get". Quote Link to comment https://forums.phpfreaks.com/topic/189454-passing-value/#findComment-1000178 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.