kuyaRomeo Posted September 28, 2011 Share Posted September 28, 2011 In a nutshell: I am using Mysql to query a table, and bring back the results, then doing a php WHILE, and in that while I am placing an image for each record. I want to do a swap image for another image . . on this image. So that is why it is done using "echo statements" and not raw html. I have tested it in HTML and it works fine, but I must be missing something here: <? while($row = mysql_fetch_array($result2)) { $thumb = $row['thumb']; $dirdesimage = $row['dir_des_image']; echo "<a href='http://mysite.net/director/vidpop.php?val1=". $vid ."'onclick='basicPopup(this.href);return false' onmouseout='MM_swapImgRestore()' onmouseover='MM_swapImage('movieThumb','','http://mysite.net/images/gallery/".$thumb."',1)'><img src='http://mysite/director/images/reel.png'></a>"; } ?> When I mouse over the reel image above . . the other image does nothing. This is the image that should be swapping out: <? echo "<a href='#' onmouseout='MM_swapImgRestore()' onmouseover='MM_swapImage('movieThumb','','http://cantankerousme.net/images/gallery/".$thumb."',1)'><img src='http://cantankerousme.net/images/gallery/OR_trailer_thumb.png' name='movieThumb' width='330' height='230' border='0' id='movieThumb' /></a></div>"; ?> </div> This way, in plain HTML I am doing the same thing, basically and it is working. I am using one image to control the swap out of another image and it works fine . .so what am I missing in the php echo statement ?? <div id="tester"> <a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('movieThumb','','../images/gallery/TTN_trlr_thumb.png',1)"><img src="../images/gallery/<? echo $thumb; ?>" name="Image5" width="330" height="230" border="0" id="Image5" /></a> </div> Thanks for your insight Link to comment https://forums.phpfreaks.com/topic/247997-trying-to-do-a-mouseover-event-within-php-while/ Share on other sites More sharing options...
Buddski Posted September 28, 2011 Share Posted September 28, 2011 Try this echo "<a href=\"http://mysite.net/director/vidpop.php?val1=". $vid ."\" onclick=\"basicPopup(this.href);return false\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('movieThumb','','http://mysite.net/images/gallery/".$thumb."',1)\"><img src=\"http://mysite/director/images/reel.png\"></a>"; Link to comment https://forums.phpfreaks.com/topic/247997-trying-to-do-a-mouseover-event-within-php-while/#findComment-1273408 Share on other sites More sharing options...
oyster12 Posted September 28, 2011 Share Posted September 28, 2011 I don't kown why. but you have a obvius error here: onmouseover='MM_swapImage('movieThumb','','http://cantankerousme.net/images/gallery/".$thumb."',1)'> a uncorrect useage parsing of qutoe you can try this: echo "<a href='...' "."MM_swqpImage('movieThumb','http://cantankerousme.net/images/gallery/' ".$thumb.",1)>"; Link to comment https://forums.phpfreaks.com/topic/247997-trying-to-do-a-mouseover-event-within-php-while/#findComment-1273414 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.