Aunque este es un foro de php .. la solucion la implemente en cgi ... tan solo desde tu php pasas el valor
Código PHP:
<a href="usuario/maps.cgi?id="<?php echo $maps[idMapa]; ?>" class="ciudades"><strong>mapa</strong></a>
CGI
Código PHP:
#!/usr/bin/perl -w
use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);
#use warnings;
print header;
use lib('perl');
use HTML::GoogleMaps;
use conectar;
$map_key ="AQUI VA LA LLAVE QUE ENTREGA GOOGLE";
#------------------------------------------------------------
#------ DIMESION DE MAPA CREADO ----------------------------
$map = HTML::GoogleMaps->new(key => $map_key,
height => "615",
width => "870");
#-----------------------------------------------------------------
#-------------- SE CREN LOS ICONOS AMOSTRAR ---------------------#
$map->add_icon(name => 'especialistas',
image => '../img/indicador_especialistas.png',
shadow => '../img/indicador_especialistas.png',
icon_size => [ 60, 70 ],
shadow_size => [60, 70 ],
info_window_anchor => [ 25,15 ],
icon_anchor => [5,70 ]
);
#-----------------------------------------------------------------------------
my($dbh,$sth);
$dbh = conectar->connect();
#-----------------------------
#conexion para consultar los campos de la tabla mapas
$sth = $dbh->prepare('SELECT x, y, d, tipo, idEspecialista FROM mapa WHERE idMapa = ?') or die("Couldn't prepare statement: " . $dbh->errstr);
$sth->execute(param('id')) or die("Couldn't execute statement: " . $sth->errstr);
my ($cx, $cy, $descrip, $tipo, $especialista) = $sth->fetchrow_array();
$sth->finish;
$dbh->disconnect;
$x = $cx;
$y = $cy;
$z = 17;
$html = $descrip;
$map->add_marker(noformat => 1,
point => [$y, $x ],
html => "$html",
icon => "$tipo","l"
);
#-----------------------------
#conexion para agregar los puntos cercanos
$sth = $dbh->prepare('SELECT x, y, d, tipo, idEspecialista FROM mapa') or die("Couldn't prepare statement: " . $dbh->errstr);
$sth->execute() or die("Couldn't execute statement: " . $sth->errstr);
my @mapa = $sth->fetchrow_array();
$sth->finish;
$dbh->disconnect;
my $emps = $dbh->selectall_arrayref(
"SELECT x, y, d, tipo, idEspecialista FROM mapa",
{ Slice => {} }
);
foreach my $emp ( @$emps ) {
# ciclo que agrega los puntos traidos de la BD
if( ($emp->{'tipo'} ne $tipo) && ($especialista == $emp->{'idEspecialista'} ) ) {
$map->add_marker(noformat => 1,
point => [$emp->{y}, $emp->{x} ],
html => "$emp->{d}",
icon => "$emp->{tipo}","l");
}
}
$map->v2_zoom($z);
$map->controls("small_zoom_control","map_type_control");
my ($head, $map_div) = $map->onload_render;
print "<html>";
print "<head>";
print "$head";
print "</head>";
print '<body onload="html_googlemaps_initialize()">';
#print ($cx, $cy, $descrip, $tipo);
foreach my $emp ( @$emps ) {
#print "x: $emp->{x}<br>";
#print "y: $emp->{y}<br>";
#print "tip: $emp->{tipo}<br>";
#print "d: $emp->{d}<br>";
}
print $map_div;
print "</body>";
print "</html>";
ESPERO TE SIRVA ... POQUE A MI ME FUNCIONA MUY BIEN ...