| re: Mixing HTML PHP and sharing Data between Scripts
If the number of points is small you can pass them to the image generating
script through the URL. You can also use a session variable to hold the
data, which is somewhat tricky because there're race hazards to consider.
Unless the performance is unacceptable, I would stick with the solution you
have now. The first query would probably be cached by your db server, so the
second query isn't as expensive as you think.
Uzytkownik "Steve W" <zacware@comcast.net> napisal w wiadomosci
news:d56dfbc8.0403231630.6f55e412@posting.google.c om...[color=blue]
> I tried searching first, but couldn't find an answer
>
> My first shot at PHP (what a cool language!)
>
> Wrote a quick script to query a server for xml data and plot it as
> points on a map
>
> Easy......, but then I wanted to take that same data set and create an
> IMAGE MAP in HTML via PHP so I could click on each data point
>
> It seems that imagepng won't work surrounded by HTML in the same code
>
> my work-around was to basically query the server once to create the
> plotted image, and then query the server again in a separate script to
> create the image map
>
> while this works, I am querying the server twice for the same data
> since I can't figure out how to share thte data with the script that
> creates the actual image and the script that creates the html image
> map
>
> here is sort of kind of what I would like to do....
>
> $URL = 'http://blahblahblah';
> $RawData = @file_get_contents("$URL");
> <HTML>
> <BODY>
> <img src="myscript.php?mode=MakeGraphic&data=$RawData"
> <map name="mymap">
> <?php myscript.php?mode=MakeImageMap ?>
> <map>
> <BODY>
> </HTML>[/color] |