tcorbeil Posted March 16, 2007 Share Posted March 16, 2007 Ok.. run into a new problem... I have a page that calls an external script for processing and I need a variable from the main page to be available in the external script.. Is there a way to pass a variable from the main page into the external script? Or if not, is there a way to make the variable global os something? Thanks. T. Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 16, 2007 Share Posted March 16, 2007 lookup up $_GET[''] or session's Quote Link to comment Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 Using curl you can send specific headers, along with this you can send "POST" data and store that variable in the POST data. http://us3.php.net/manual/en/ref.curl.php Or you can do something like this: http://www.site.com/external.php?varname=value that will allow you to pull the value via $_GET data. Quote Link to comment Share on other sites More sharing options...
interpim Posted March 16, 2007 Share Posted March 16, 2007 $_GET $_POST $_COOKIE , etc... Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted March 19, 2007 Author Share Posted March 19, 2007 Ok so i do this: <? $Page=$_SERVER['SCRIPT_FILENAME']; include("http://www.xxxxxxx.com/Global/posting.php?$Page"); ?> Now, in posting.php, i believe i tried a few things the retreive the variable value of $Page but wasn't succesfull.. can someone enlighten me? thanks. T. Quote Link to comment Share on other sites More sharing options...
drewbee Posted March 19, 2007 Share Posted March 19, 2007 That variable SHOULD be available.... if you have $myVariable = "test"; include("/print_test.php"); and if print_test.php is > echo $myVariable; It should print it out. Not sure why their is an issue here. Just make sure the call is after it. Try looking into functions if it is causeing problems and pass it to the function if needed. Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted March 19, 2007 Author Share Posted March 19, 2007 I noticed that your include does not have let's say ?$myVariable at the end of the php file.. am i missing something? Also, you mention to echo $myVariable but can I do something like: $var2 = echo $myVariable; Thanks. T. Quote Link to comment Share on other sites More sharing options...
tcorbeil Posted March 19, 2007 Author Share Posted March 19, 2007 It seems that most instances where I have seen variables passed were from HTML script (eg href="script.php?myvalue")to another page.. I gues in my situation I'm looking to pass a variable from a php script .. is this maybe why I am not getting anywere? In my previous post, you will see how I am trying to pass the varible.. maybe this is not possible? Thanks. T. Quote Link to comment 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.