Cheeki 0 Newbie Poster

Hey guys,

I'm having a small problem with getting a image map to work when I generate it with PHP.

I'm using two separate files. The one is used to display the image which has the image map and the other file is the code I use to retrieve the data from a database and insert that data into the image map code. The problem I'm having, is that when the page is loaded there are no hot spots so the image was not linked to the image map. And I don't know why this is happening!!

The function.php file code is as follows:

<?php

function getFlowDiagram ()
{
	$flow_diagram_query = "SELECT * FROM flow_diagrams  
WHERE id = '1'";   
    $flow_diagram_results = mysql_query($flow_diagram_query);	
	$flow_diagram_row = mysql_fetch_array($flow_diagram_results);
	
	$flow_diagram_id = $flow_diagram_row['id'];
	$flow_diagram_map = $flow_diagram_row['image_map_name'];
	$flow_diagram_value = $flow_diagram_row['diagram_image'];
 	$create_flow_diagram = "<img border=\"0\" src=\"../img/standards/ISO9001/$flow_diagram_value\" semap=\"#$flow_diagram_map\"><br></td>";
  
  	$image_map_query = "SELECT * FROM image_map WHERE map_name = 'FPMap0'";   
    $image_map_results = mysql_query($image_map_query);	
	$image_map_row = mysql_fetch_array($image_map_results);
  	
	$image_map_link = $image_map_row['map_links'];
	$image_map_shape = $image_map_row['shape_name'];
	$image_coordA = $image_map_row['coord_topA'];
	$image_coordB = $image_map_row['coord_topB'];
	$image_coordC = $image_map_row['coord_bottemA'];
	$image_coordD = $image_map_row['coord_bottemB'];
	
  	print "<map name= $flow_diagram_map>";
		print "<area href=\"$image_map_link\" shape=\"$image_map_shape\" coords=\"$image_coordA, $image_coordB, $image_coordC, $image_coordD\">";
	print "</map>";
  
  	print $create_flow_diagram;	
}
?>

To display the image to the users the code is as follows: getFlowDiagram (); Now the whole point of me doing this in PHP is because I have many different images with different image maps to display and using a database allows me to generate the code dynamically.

Hope someone can help with this problem
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.