Link to php page from html
I'm newbie ini web builder and I need some help.
My webpage contains both html (for static page) and php (for dynamic page).
I've make a link in the html that link to the php page.
The problem is: the link doesn't work if i start the web from html page (such index.html) BUT the link works when i start the web from php page, WHY???
Its quite difficult to tell you why something is not working if we can't see the thing that's not working.
Its like telling a mechanic to fix your car without letting him ever see the car. While telling your mechanic what the problem is might allow him to solve some very minor problems, there is no chance he will be able to fix your car if the problem is more complex.
So, if in doubt, always post your code.
Linking to php is exactly the same as linking to html:
<a href="imhtml.html">This is a link to a html page</a>
<a href="imphp.php">This is a link to a php page</a>
Thanks for your help.
My link code is exactly same as your sample.
I think I've found the answer of the problem by myself.
My sharing about my problem:
I'm using Apache as my localhost.
When I start my webpage from html page, my IE browser locate the address at D:\myweb\index.html, not to http://localhost/myweb/index.html so the link cannot execute the php page since it's not in the server side. So, I will always remember to start my webpage from localhost, even the html one and it's work. So I always type http://localhost/myweb/index.html instead of D:\myweb\index.html
Am I right? Is there advance way to manipulate this thing for a newbie?
Thanks for your help.
My code as same as your sample and I think I've solved the problem by myself.
I'd like to share them:
I use Apache as my local server.
So when I start the page from html page, I just executed it from Windows Explorer and IE opened it with the address is D:\myweb\index.html not http://localhost/myweb/index.html. Since I didn't start the index.html in localhost, so the link couldn't make an php page.
Am I right? Or is there any simple and advance way to solve it?
You are exactly right. Serving a file off a file system is a totally different thing from serving an HTTP response.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)