johnwayne77 Posted April 26, 2007 Share Posted April 26, 2007 let's say I have file a.php as following: a.php <? $var = "john"; ?> now, i have b.php as following: <? include a.php; ?> my question is how can I manage to echo the 'john' value of $var variable by manipulating the b.php just from the browser view? Link to comment https://forums.phpfreaks.com/topic/48765-echo-variable/ Share on other sites More sharing options...
kenrbnsn Posted April 26, 2007 Share Posted April 26, 2007 Just doing an "echo $var" should work fine. What happens when you try it? Ken Link to comment https://forums.phpfreaks.com/topic/48765-echo-variable/#findComment-238979 Share on other sites More sharing options...
johnwayne77 Posted April 26, 2007 Author Share Posted April 26, 2007 i was thinking more of doing the echo from the URL bar, like www.example.com/b.php?echo=.$var. i am not sure how to query the variable by URL bar Link to comment https://forums.phpfreaks.com/topic/48765-echo-variable/#findComment-239258 Share on other sites More sharing options...
kenrbnsn Posted April 26, 2007 Share Posted April 26, 2007 Do you want to create a url with the value of the variable in it <?php $url = 'www.example.com/b.php?var=' . $var; ?> Or do you want to get the value from the URL? http://www.example.com/b.php?var=value the in the script <?php $var = $_GET['var']; echo $var; ?> Ken Link to comment https://forums.phpfreaks.com/topic/48765-echo-variable/#findComment-239297 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.