matty84 Posted November 16, 2006 Share Posted November 16, 2006 Hi,I am tryingo to create a link to an image in a database using php. the following code works when the images do not have spaces:echo "<td><a href=dbimages/$photo target=new>$photo</a></td>"; but some images are labelled 1223 - 2323.jpg for example (with spaces). When viewing the page the link for these images coes out like :http://.../1223is there a way to tell php to include the spaces but make them %20 or something??Matt Link to comment https://forums.phpfreaks.com/topic/27441-spaces-in-hyperlinks-using-php/ Share on other sites More sharing options...
matty84 Posted November 16, 2006 Author Share Posted November 16, 2006 ignore the [/url] :) Link to comment https://forums.phpfreaks.com/topic/27441-spaces-in-hyperlinks-using-php/#findComment-125484 Share on other sites More sharing options...
fiddy Posted November 16, 2006 Share Posted November 16, 2006 why dont you try like this:echo "<td><a href='dbimages/".$photo."' target=new>".$photo."</td>"; Link to comment https://forums.phpfreaks.com/topic/27441-spaces-in-hyperlinks-using-php/#findComment-125488 Share on other sites More sharing options...
matty84 Posted November 16, 2006 Author Share Posted November 16, 2006 perfect!!!Thankyou so much Link to comment https://forums.phpfreaks.com/topic/27441-spaces-in-hyperlinks-using-php/#findComment-125494 Share on other sites More sharing options...
fiddy Posted November 16, 2006 Share Posted November 16, 2006 Welcome!! Link to comment https://forums.phpfreaks.com/topic/27441-spaces-in-hyperlinks-using-php/#findComment-125496 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.