954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Href Basic Issue

I saved the link refrence in Databse like /PEDB/SupportDoc/5/PRFF or0444.pdf
and used <a href=".$r1[10]." target=_blank>View</a>
to show the documents but when I click on view its not showing document because link break where space put in and show blank in explorer like /PEDB/SupportDoc/5/PRFF

ayesha789
Posting Pro in Training
496 posts since Jun 2009
Reputation Points: 17
Solved Threads: 7
 

I think this is what you are looking for

$a = "/PEDB/SupportDoc/5/PRFF or0444.pdf";
 $b = urlencode($a);
 echo "<a href='{$b}'>Click</a>";
jigarvyas
Newbie Poster
11 posts since Oct 2009
Reputation Points: 10
Solved Threads: 3
 

I think this is what you are looking for

$a = "/PEDB/SupportDoc/5/PRFF or0444.pdf";
 $b = urlencode($a);
 echo "<a href='{$b}'>Click</a>";


When i did this it shows
/PEDB/%2FPEDB%2FSupportDoc%2F5%2FPRFFor0444.pdf

Any other idea?

ayesha789
Posting Pro in Training
496 posts since Jun 2009
Reputation Points: 17
Solved Threads: 7
 

Please guide me in this issue...

ayesha789
Posting Pro in Training
496 posts since Jun 2009
Reputation Points: 17
Solved Threads: 7
 

I think its not because of space.
Your href link must start with http:// to work in browser.
When you click on link what is url shown in browser?

vibhaJ
Posting Shark
931 posts since Apr 2010
Reputation Points: 161
Solved Threads: 183
 

You don't have to have http:// in the href.

The space shouldn't be there. Filenames should not have spaces in them. I'd go at it to change them - change them from space to underscore or similar.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

I have checked with test name.txt and it works fine in my browser.
and if i give only google.com in my href it won't work.
You don't have to have http:// in the href.

The space shouldn't be there. Filenames should not have spaces in them. I'd go at it to change them - change them from space to underscore or similar.

vibhaJ
Posting Shark
931 posts since Apr 2010
Reputation Points: 161
Solved Threads: 183
 
I think its not because of space. Your href link must start with http:// to work in browser. When you click on link what is url shown in browser?


My link starts with http:// then local ip then this part /PEDB

as PEDB in root so I do not required to write Http , browser adds automatically

ayesha789
Posting Pro in Training
496 posts since Jun 2009
Reputation Points: 17
Solved Threads: 7
 

You don't have to have http:// in the href.

The space shouldn't be there. Filenames should not have spaces in them. I'd go at it to change them - change them from space to underscore or similar.


any encoding Technique will work ????

ayesha789
Posting Pro in Training
496 posts since Jun 2009
Reputation Points: 17
Solved Threads: 7
 

If you're accessing files in your own domain you do not need 'http://' in the href, you can use absolute or relative references. If you're trying to access files outside your serves, yes you will need some flavour of http://, https:// etc.

You can have spaces in filenames, but be aware that this can cause all sorts of problems. The easiest thing to do is to convert spaces to underscores. Encode if you want, but I think it's best to apply sensible filenames in the first instance. If these files are not yours and you cannot change them (e.e. not your domain), you won't be able to do this though. Having said that, I can't remember the last time I downloaded a file with a silly symbol (space, etc) in it.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

href is not an issue . its work anywhere.

holy-food
Newbie Poster
5 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

Have you tried quotes around href

View

urtrivedi
Nearly a Posting Virtuoso
1,306 posts since Dec 2008
Reputation Points: 257
Solved Threads: 270
 

View It's just like a circulate.

lovewow
Newbie Poster
1 post since Apr 2011
Reputation Points: 10
Solved Threads: 1
 

Why waste all the time while you can solve the problem by removing space? I cannot see what is so peculiar about that space. as Ardav said, remove it and you will be fine!

evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
 

I convert the file names according to my needs and save in DB without spaces.

ayesha789
Posting Pro in Training
496 posts since Jun 2009
Reputation Points: 17
Solved Threads: 7
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: