maybe I just have to use a cookie like the above example? -Beth
On Mar 19, 11:16 am, Beth <[email protected]> wrote: > Below is my KML producing script. It seems to work fine at figuring > out how to do the right database filter and output the positions of > whatever voyage number is passed through the URL parameter when I put > in a valid number, ie if I call it with > var kml = new GGeoXml("http://IntegratedStatistics.com/ejosephs/ > v2pages/makekml2.php?voyageccc=12950"); > > It does not work when I try to send it variable obtained from user > input like > var kml = new GGeoXml("http://IntegratedStatistics.com/ejosephs/ > v2pages/makekml2.php?voyageccc=$Voyage"); > > where in the html $Voyage has been assigned the value of $_GET > ['voyageccc'] and the page is called with > > http://www.integratedstatistics.com/ejosephs/v2pages/MapCachalot3.php... > > Thanks, > -Beth > > <?php > //connect to database > require_once('../Connections/connIsris.php'); > > //get URL parameter > $voyagerequested = $_GET['voyageccc']; > > //execute mysqlquery > mysql_select_db($database_connIsris, $connIsris); > $query_rsSarahHunt = "SELECT * FROM tblSarahHunt WHERE voyageccc = > $voyagerequested"; > $rsSarahHunt = mysql_query($query_rsSarahHunt, $connIsris) or die > (mysql_error()); > $row_rsSarahHunt = mysql_fetch_assoc($rsSarahHunt); > $totalRows_rsSarahHunt = mysql_num_rows($rsSarahHunt); > > // Prepare the KML header > $header = '<?xml version="1.0" encoding="UTF-8"?> > <kml xmlns="http://earth.google.com/kml/2.2"> > <Document> > <name>Map some voyages of Sarah Hunt</name> > <Style id="city_style"> > <IconStyle> > <Icon> > <href>http://maps.google.com/mapfiles/kml/pal4/icon56.png</ > href> > </Icon> > </IconStyle> > </Style>'; > // Generate KML placemarks for the retrieved data > while ($row = mysql_fetch_array($rsSarahHunt)) > { > $placemarks = $placemarks.' > <Placemark id="'.$row['voyageccc'].'_'.$row['DATE'].'"> > <name>'.$row['voyageccc'].'_'.$row['DATE'].'</name> > <description>'.$row['species'].' > </description> > <Point> > <coordinates>'.$row['InterpolatedLong'].','.$row > ['InterpolatedLat'].',0</coordinates> > </Point> > </Placemark>'; > } > > // Prepare the KML footer > $footer = ' > </Document> > </kml>'; > > // Output the final KML > header('Content-type: application/vnd.google-earth.kml+xml'); > echo $header; > echo $placemarks; > echo $footer; > ?> > > On Mar 17, 3:44 am, Andrew Leach <[email protected]> > wrote: > > > On Mar 17, 12:31 am, Beth <[email protected]> > > wrote:http://www.integratedstatistics.com/ejosephs/v2pages/MapCachalot3.php > > > > makes a php script query the database and plot the right voyage, but > > > only if I add the actual voyageID (the parameter I would like to pass > > > to the page) as the URL parameter (?voyageccc=12950). It doesn't work > > > if I add ?voyageccc=$voyage. > > > A url like mycode.php?voyageccc=12950 will generate a $_GET > > ['voyageccc'] with value 12950. You can assign a variable to make it > > more manageable: $voyage=$_GET['voyageccc']; > > > Make sure you investigate and implement some security checks and do > > not blindly use a passed parameter in your SQL. > > > Andrew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
