I am working on an image map functionality that when you click on a specific area in the map specific MySQL commands get executed.
The image map:
<img id="harta" src="img/hartap.png" alt="testmap" usemap="#Map" />
<map name="Map" id="Map">
<area class="area1" alt="area1" title="area1" href="#table" shape="poly" coords="898,3071,902,3553,1108,3561,1129,3419,1254,3419,1278,3273,1472,3261,1476,3100" />
<area class="area2" alt="area2" title="area2" href="#table" shape="poly" coords="842,2759,846,3035,1896,3076,1917,2816,1345,2774" />
<area class="area3" alt="area3" title="area3" href="#table" shape="poly" coords="942,2327,934,2752,1342,2764,1380,2333" />
</map>
The section with PHP code:
<section id="table" class="row">
<?php
require_once('config.php');
$reg = "theclickedarea"; // THIS VARIABLE HAS TO BE MODIFIED DEPENDING ON THE CLICKED AREA
$con = mysql_connect("$host", "$username", "$password") or die(mysql_error());
$db = mysql_select_db("$db_name") or die(mysql_error());
$sql=mysql_query("SELECT name, score FROM table WHERE game='".$reg."'") or die(mysql_error());
$count=0;
echo '<table>
<thead>
<tr>
<th>name</th>
<th>score</th>
</tr>
</thead>
<tbody>';
while($row = mysql_fetch_array($sql))
{
$name=$row['name'];
$score=$row['score'];
echo
'<tr>
<td>'.$name.'</td>
<td>'.$score.'</td>
</tr>';
$count++;
}
echo ' </tbody> </table> ';
?>
</section>
Can someone help me do this?