noob query

A

Anonymous

Guest
Any ideas why i'm gettin this error

PHP Notice: Undefined variable: name in c:\inetpub\wwwroot\test10.php on line 10

for this script

2 <html>
3 <head>
4 <title>Untitled Document</title>
5
6 </head>
7
8 <body>
9 <?php
10 if($name !="")
{
echo"<p align = 'left'><b><i>$name</b></i></p>";
}
?>
<a href="test10.php?name=one">One</a><br>
<a href="test10.php?name=two">Two</a>

</body>
</html>
 
are you passing the value as a url query string?

you might want to upgrade your variable references to account for super global arrays

if(isset($_GET['name']) && $_GET['name'] !== "")
{
// name=value exists in the url, so do stuff.

}

Older versions of PHP would use $HTTP_GET_VARS['name']
 
Back
Top