Jump to content

variable passing


tcorbeil

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/43056-variable-passing/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/43056-variable-passing/#findComment-209144
Share on other sites

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/43056-variable-passing/#findComment-210262
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/43056-variable-passing/#findComment-210266
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/43056-variable-passing/#findComment-210329
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.