Incorporating a Javascript with PHP in a menu-
Posted: Wed Aug 01, 2007 11:08 am
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have created a menu which, when linked with a javascript, displays a logo off to the side of the link. I can get it to display only the first image in the database. I am certain it's a simple fix, but I am too close to it now and am unable to see my error. I would appreciate assistance to get this to work properly. The code follows. What am I doing wrong and why does it only show the image of the first listing in the database? Otherwise everything else works well.
Thank you,
SuziCode: Select all
<? include ('db/connect.php');
foreach($_REQUEST as $key=>$value) {
$$key=$value;
}
$sql = "SELECT * FROM manuf where manstat='yes' ORDER BY manname ASC";
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
while ($row = mysql_fetch_array($sql_result)) {
$manid= $row['manid'];
$manname= $row['manname'];
$manurl= $row['manurl'];
$manimage= $row['manimage'];
$manstat= $row['manstat'];
?>
<script language="javascript">
function show(id,x,y,tf) {
if (tf == true) {
id.style.display = "block"
id.style.left = x + "px"
id.style.top = y + "px"
}
if (tf == false) {
id.style.display = "none"
}
}
</script>
<div onmouseover="show(image1,200,200,true)" onmouseout="show(image1,200,200,false)">
<a href="http://<?=$manurl?>" target="_blank"><?=$manname?></a>
</div>
<img src="images/<?=$manimage?>" style="position:absolute;display:none" id="image1">
<? }; ?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]