leon Posted April 13, 2006 Share Posted April 13, 2006 Hello, I was trying to insert rollover image script to php. But I dont think it will be easy. can you check this code please? How can it be adjusted? [code]<?php echo "<a href=\"$PHP_SELF?page=$pageNum&product_id={$data['id']}\" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image71','','{data['image_roll']}',1)">"; ?>[/code]Image_roll is the field from the database. Quote Link to comment Share on other sites More sharing options...
deadonarrival Posted April 13, 2006 Share Posted April 13, 2006 Javascript is all run after your PHP is parsed, so basically just get PHP to echo exactly what you want to appear in the browser.As long as your slashes and brackets dont overlap (for want of a better word appearing in my head right now) it will work fine. Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted April 13, 2006 Share Posted April 13, 2006 you might be forgetting to escape your quotes. When using quotes within quotes, you need to put a backslash infront of the internal quote...so, "\"" would equal "I added backslashes to your code around the mouseover and mouseout -- should work fine now.[code]<?php echo "<a href=\"$PHP_SELF?page=$pageNum&product_id={$data['id']}\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image71','','{data['image_roll']}',1)\">"; ?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.