I am kind of stumped here... I'm trying to change this into php friendly code: <a href="#" onmouseover="changeImages('image_button1', 'images/image_button1-over.gif'); return true;" onmouseout="changeImages('image_button1', 'images/image_button1.gif'); return true;"> Code (markup): and this is what I came up with... works in Firefox, but in IE, it says that there is an error. so I dont think IE can read the ' as an apostrophe... <?php echo" <a href='$image' onmouseover='changeImages('image_button1', 'images/image_button1-over.gif'); return true;' onmouseout='changeImages('image_button1', 'images/image_button1.gif'); return true;'>"; ?> Code (markup): does anyone have a solution?
<?php echo '<a href="'. $image .'" onmouseover="changeImages(\'image_button1\', \'images/image_button1-over.gif\'); return true;" [...] Code (markup):
<?php echo "<a href=\"$image\" onmouseover=\"changeImages('image_button1', 'images/image_button1-over.gif'); return true;\" \n onmouseout=\"changeImages('image_button', 'images/image_button1.gif'); return true;\">";?> PHP: test:
My code is perfectly fine. Using single quotes instead of double quotes should always be the way to go. Now if you bothered to post an error message I could have helped you, but I'm afraid I can't read your mind yet.
Of course not. You cannot change from single to double quotes and expect PHP to behave the same. Programs such as Perl and PHP consider single and double quotes differently. Material between single quotes is treated literally. This allows you to place special characters within the string without needing to escape the special characters with a backslash. A fair explanation is at the PHP site: http://ca.php.net/types.string A bit of a tutorial on the subject is located here: http://www.astahost.com/info.php/php-interpolation_t4286.html In terms of whether or not single or double quotes are faster . . . it seems the answer depends. Material between single quaotes is not processed for the presence of variables, whereas double quoted strings may contain variables. In certain situations, single quotes result in speed gains. But, there are probably more significant optimizations which you can make. A good article on optimization is located here: http://phplens.com/lens/php-book/optimizing-debugging-php.php
thank you. this works perfectly. ill add some green. sorry, there wasn't any error message... the onmouseover just didn't work and IE kept displaying that there was an error with the page on the status bar.
Stop talking trash, it's the other way round. If you use single and double quotes exactly the way I showed you, it will work.
or (to remove the horrid use of back-slashes): <?php echo <<<EOF <a href="#" onmouseover="changeImages('image_button1', 'images/image_button1-over.gif'); return true;" onmouseout="changeImages('image_button1', 'images/image_button1.gif'); return true;"> EOF; ?> Code (markup):