Copy link to clipboard
Copied
Hi all,
I seem to be missing a few html link basics. What is the significance of:
starting slash...?
<form action="/mypage.php" method="POST"> like:
I know these can redirect:
dig down..
/myfolder/mypage.php
and up
../myfolder/mypage.php
but now I am seeing a starting slash and a page ???
/mypage.php
or
./mypage.php
instead of just = mypage.php
Q: why use starting ./ or / instead of just the page?
MORE...
and while I am at it... I always use closing php tag like:
<?php
stuff...
?>
... but now I am hearing if there is only php on the page - then it's best to *NOT* use a closing tag?
Q: Why is that?
The starting slash means "site root relative" which tells the browser to add the site root before the link, so...
/somelink.html
...becomes...
h t t p ://www.domain.com/somelink.html (spaces added to http keep the forum from turning it into a link)
...automatically at the browser level.
Not sure about the php thing, always heard that as you "can" leave it out.
Copy link to clipboard
Copied
The starting slash means "site root relative" which tells the browser to add the site root before the link, so...
/somelink.html
...becomes...
h t t p ://www.domain.com/somelink.html (spaces added to http keep the forum from turning it into a link)
...automatically at the browser level.
Not sure about the php thing, always heard that as you "can" leave it out.
Copy link to clipboard
Copied
Great - thanks for the help!
so now I get /somelink.html
what about with starting period = ./somelink.html ?
Copy link to clipboard
Copied
That means somelink.html is in the same folder (directory).