HREF="" automatically adds to current page URL (in PHP). Can't figure it out
This is how a browser interprets and empty href. It assumes you want to link back to the page that you are on. This is the same as if you dont assign an action to a <form>
element.
If you add any word in the href it will append it to the current page unless you:
- Add a slash
/
to the front of it telling it to append it to your base url e.g.http://www.whatever.com/something
- add a
#
sign in which case it is an in-page anchor - or a valid URL
EDIT: It was suggested that I add a link to help clarify the situation. I found the following site that I think does a really good job explaining the href
attribute of anchor tags and how it interprets URL paths. It is not incredibly technical and very human-readable. It uses lots of examples to illustrate the differences between the path types: http://www.mediacollege.com/internet/html/hyperlinks.html
Add http:// in front of url
Incorrect
<a href="www.example.com">www.example.com</span></p>
Correct
<a href="http://www.example.com">www.example.com</span></p>
if you want to redirect it to some other url lets google.com then make your like as
happy to help other says rikin <a href="//google.com">happy to help other says rikin</a>
this will remove self site url form the href.