Database driven website pg 82 book copyright 2009

I’m running WAMP , PHP 5.3.0, MYSQL 5.1.36 and APACHE 2.2.11

The first excercise using today.php worked fine. I type into my browser -> http://localhost/today.php and I get the desired result i.e. date shows up. But for the welcome1.html , which is in my the C:\WAMP\ directory just like ‘today.php’, I type into my browser http://localhost/welcome1.html and it returns with a 404 error, page not found. Since the stuff I typed in wasn’t working I am using exact copies of what’s in your code archive.

Not sure what I’m doing wrong?

I can go through explorer and click on the html file and it works, kinda, but when I click on the link (Hi my name is kevin) it just brings me to a “file///c:/wamp/welcome1.php…” . From reading other customers’ issues on this I realize you can’t click on the link from explorer.

Help please? thanks, emagify

Is the file extension actually .htm, rather than .html?

The mark-up for the HTML page is

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>Query String Link Example</title>
		<meta http-equiv="content-type"
				content="text/html; charset=utf-8"/>
	</head>
	<body>
		<p><a href="welcome1.php?name=Kevin">Hi, I&rsquo;m Kevin!</a></p>
	</body>
</html>

The link is a “relative” link (as opposed to “absolute” like your type into the address bar).

Because its a relative link and you’re going to it through your OS it looks for it as a “file” instead of “http”.

Because you’re getting
“file///c:/wamp/welcome1.php…”
I’m guessing you put the file directly under the WAMP app folder instead of under the htdocs folder.

When you sart up the server and go to a localhost HTTP address, it does NOT look in the main WAMP app folder, but goes directly to the htdocs folder.

The file is .html

I put both files (welcome1.php and welcome1.html; the html file calls the php file) in the htdocs folder (wamp/bin/apache/apache2.2.11/htdocs). Then I tried to run it by typing http://localhost/welcome1.html . It still gives me the 404 file not found error.

Is that the right htdocs folder?

Not sure what you mean by “Because its a relative link and you’re going to it through your OS it looks for it as a “file” instead of “http”.”

Appreciate your attempts to help me. mark

Sorry for the slower response, lost the momentum of helpers. Any ideas to help me

Relative links will work in a web page with Windows explorer and IE.
eg. if you put these on your computer in any folder anywhere and click on them to open.

page1.html

<html><head><title>page1</title></head>
<body>
<a href='page2.html'>page 2</a>
</body></html>

page2.html

<html><head><title>page2</title></head>
<body>
<a href='page1.html'>page 1</a>
</body></html>

But absolute links with the “http” need to go to a server.

AFAIK that should be the right “htdocs” folder (there should be only one),

Maybe you need to use a port? But as the PHP file is OK I doubt that.

Try starting the server and pointing your browser to
http://127.0.0.1/welcome1.html

And double check spelling and case. Welcome is not the same as welcome

Thanks for the help. Spelling was correct. I put them in the www folder under wamp and it worked fine.

Just don’t know why under www it worked but not under the main wamp or under htdocs?

thank you.