Think of it this way.
Anything that you type after localhost/
is the path inside the root directory of your server(www or htdocs).
You don't need to specify the complete path of the file you want to run but just the path after the root folder because putting localhost/
takes you inside the root folder itself.