Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Quotes with Javascript from PHP?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Quotes with Javascript from PHP?

Postby imroue » Wed Oct 23, 2002 7:18 pm

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);
User avatar
imroue
New php-forum User
New php-forum User
 
Posts: 62
Joined: Fri Oct 11, 2002 6:53 am

Quotes with Javascript from PHP?

Postby uncertain_manos » Wed Oct 23, 2002 9:48 pm

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
uncertain_manos
New php-forum User
New php-forum User
 
Posts: 31
Joined: Wed Oct 23, 2002 12:55 am

Postby Jay » Thu Oct 24, 2002 1:51 am

Try:
<img src="<?=$thumbFolderFile?>" border='1'><BR>
Jay
 

Postby imroue » Thu Oct 24, 2002 7:42 am

Jay wrote:Try:
<img src="<?=$thumbFolderFile?>" border='1'><BR>


Thanks Jay!!!!!!

Sometimes the obvious is not obvious!
User avatar
imroue
New php-forum User
New php-forum User
 
Posts: 62
Joined: Fri Oct 11, 2002 6:53 am


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 7 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron