I'm getting unexpected '.' error in the following code <a href= "hello.php" onclick=" <?php return ShowImage('$ImagePath', . str_replace('','"', str_replace(',',$GetProduct["product_Name"]))')" ?> >Click Here</a> Code (markup): Thanks
ShowImage( $ImagePath, str_replace('','"', str_replace('','',$GetProduct["product_Name"])) ); PHP: This should work, however i cannot tell because your code is a bit messed up. However what i am certain of is that str_replace('', 'something', 'text') won't replace anything because you are not searching for anything, first argument in str_replace should be a string longer then one char. Don't know if i expressed myself clearly, i hope so.
Thanks for the correction and I have another question. is it possible to have echo statement within another echo statement ?
uhhm, for your second question, probably no, and why would there be any need for that kind of code statement?
ShowImage( $ImagePath, str_replace('','"', str_replace('','',$GetProduct["product_Name"])) ); PHP:
Im trying to combine two statements into one. Code for display image; <?php echo(DisplayImage($productId, 2, $GetProduct["product_Name"], "")); Code (markup): Code for Pop Image: echo("<br/> <a href=\"ImagePath\" onclick=\"return ShowImage('$ImagePath','" . str_replace('"','"',str_replace("'","\'",$GetProduct["product_Name"])) . "')\">View Larger Image</a>"); Code (markup): How do you combine these two codes into one? Instead of clicking on the "View larger image" and pops up the large image, I want to click on the image and pops up a large image.
DisplayImage($productId, 2, $GetProduct["product_Name"], "") echo "<br/> <a href=\"ImagePath\" onclick=\"return ShowImage('{$ImagePath}','" . str_replace('"','"',str_replace("'","\'",$GetProduct["product_Name"])) . "')\">" . DisplayImage($productId, 2, $GetProduct["product_Name"], "") . "</a>"; PHP: Your code is so messy I'm not positive if that will work. I suggest putting stuff into variables and then echo'ing the variables so you can actually understand what's happening.
Thank you very much for combining two of them to one. Would you explain how you did? why use the dot ?