LINKING with an IMAGE MAP PHP
Posted: Thu Jul 28, 2011 12:25 am
I have 6 image rendering through PHP in a loop and each link it to 2 Unique pages.
When Images render they all link to the same location!
HELP IS VERY MUCH APPRECIATED.
When Images render they all link to the same location!
HELP IS VERY MUCH APPRECIATED.
Code: Select all
include "storescripts/connect_to_mysql.php";
$dynamicList = "";
$sql = mysql_query("SELECT * FROM products LIMIT 6") or die(mysql_error());
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$price = $row["price"];
$dynamicList .= '<div style="float:left; padding-right:20px; padding-bottom:12px;">
<a href="product.php?id=' . $id . '"></a><img src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" usemap="#map1"/>
<map name="map1">
<area shape="poly" coords="13,12,315,13,319,230,125,231,110,234,104,246,102,269,24,269,12,261,10,25," href="http://www.google.com/"
title="More Information" />
<area shape="rect" coords="104,236,325,317" href="inventory_images/' . $id . '.jpg" alt="" title="Larger Image!" />
</map>
</div>';
}
} else {
$dynamicList = "We have no products listed in our store yet";
}
mysql_close();
?>