I have my web site in html, with php chunks embedded. I define some variables in the main page as
<?php
$GLOBALS['myVar']= "something";
?>
later I have
<?php
echo '<p align="center"><img src="./tempImg.php">';
?>
the tempImg php file displays, using the phplot.php lib, a dynamic plot of some data read from the database and in the tempImg.php file I must use the myVar variable. I tried using the GLOBALS[], the _SESSION[] but I am not able to share the variable in this way.
thanks for any help
$GLOBALS['myVar']= "something";
echo '<p align="center"><img src="./tempImg.php?myVar=' . $GLOBALS['myVar'] . '">';
Or just:
$myVar = "something";
echo '<p align="center"><img src="./tempImg.php?myVar=' . $myVar . '">';
Then access $_GET['myVar']
in tempImg.php
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.