Quotes with Javascript from PHP?

A

Anonymous

Guest
I have an image coming from a directory.
This directory has a quote in it.. for example:

$thumbFolderFile = " /pics/baby's pics/";
<img src='<?php echo $thumbFolderFile ?>' border='1'><BR>

The problem with this, is that the quote after the "y" is causing the path not to work.... any ideas...
I tried a variation of this:

$thumbFolderFile = str_replace("'","'/",$thumbFolderFile);
 
it does not work because the final HTML will be like:

<img src=' /pics/baby's pics/' border='1'><BR>

which means that the src read by the browser is "/pics/baby" and then there is an undefined "s pics/" which the browser cannot handle and gives an error!

Hope this helps,
Manos
 
Back
Top