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 Quote 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] :) Quote 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>"; Quote 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 Quote 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!! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.