I'm just learning PHP, and during the process of learning, the tutor asked me to create two files: a HTML file and a PHP file. The HTML file (named name.html
) looks like this:
<!DOCTYPE html>
<html lang="en">
<head>
<title> Today’s Date </title>
<meta name="viewport" content="width=device-width">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<a href="name.php?name=Kevin">Hi, I’m Kevin!</a>
</body>
while the PHP file (named name.php) is this:
<!DOCTYPE html>
<html lang="en">
<head>
<title> Today’s Date </title>
<meta name="viewport" content="width=device-width">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<?php
$name = $_GET['name'];
echo 'Welcome to our website, ' . $name . '!';
?>
</body>
Now the problem is this: the php file should output “Welcome to our website, Kevin!” after the link on the html file has been clicked according to the author. But mine doesn't, in fact it doesn't output anything at all.
I wonder if there is a problem with my code. Any php expert in the house should please put me through.
thanks.