Stuck with BYO DB driven Web Site PHP and MySQL, Chapter 3, Page 82

Hello all!

I’m currently working my way through the above book, and I have come up against a problem when trying to use the example on page 82, introducing how URL query strings behave. I’m using the most up to date, non beta versions of PHP, Apache and MySQL and I have had no other issues with the examples so far, so with that said here we go;

welcome1.html contains the following;


<!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>PHP and MySQL Training Test</title>
		<meta http-equiv="content-type"
			content="text/html; charset=utf-8"/>
	</head>
	<body>
		<a href="welcome1.php?name=Kevin">Hi, I&rsquo;m Kevin!</a>
	</body>
</html>		

and welcome1.php contains the following;


<!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>PHP and MySQL Training Test</title>
		<meta http-equiv="content-type"
			content="text/html; charset=utf-8"/>
	</head>
	<body>
		<?php
			$name = $_GET['name'];
			echo 'Welcome to our web site, '.name.'!';
		?>
	</body>
</html>		

and when accessing welcome1.html and clicking the link on the page (to go to welcome.php) I get the following;


Notice: Use of undefined constant name - assumed 'name' in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\	raining\\welcome1.php on line 12
Welcome to our web site, name!

I’ve been looking at this for about an hour now and I expect that it is a very simple mistake but just can’t spot.
Any help that anyone could provide would be hugely appreciated.
Cheers

Welcome to the SP forums.

I’ve been looking at this for about an hour now and I expect that it is a very simple mistake but just can’t spot.

That happens a lot. Sometimes taking a break can bring the solution. Or asking someone else to take a look.

echo 'Welcome to our web site, '.name.'!';

Take a good look at this line. You’re missing a $ somewhere :wink:

/facedesk.

Thank you kindly. I knew someone would spot it right away :slight_smile:

The reason is because he can only think about $$$. He’s that greedy :stuck_out_tongue: runs and hides

Off Topic:

:lol:
Hmm, since you took off in my Ferrari you’ve been in a really good mood. I wonder why… :wink: