PDA

View Full Version : definning a valuable


joonstar
05-01-2003, 04:25 AM
Next code is in my index.php.
-------------------------------------------------------------------------
<a href="welcome.php?name=Kevin"> LINK </a>
--------------------------------------------------------------------------

and Next code is in welcome.php.
--------------------------------------------------------------------------
<?php
echo( "Welcome to our Web site, $name!" );
?>
---------------------------------------------------------------------------


If a user clicks the LINK in index.php,
the page is suppose to say "Welcome to our Web site, Kevin!" .

However, it says;

"Notice: Undefined variable: name in c:\program files\apache group\apache\htdocs\welcome.php on line 8
Welcome to our Web site, !"

Undefined variable?
I think I defined the variable name as name=Kevin in index.php.

What is wrong in your think?

stoodder
05-01-2003, 05:00 AM
thats the same ting that is hapening to me right now i have no clue but give this a try $HTTP_GET_VARS['name']

joonstar
05-01-2003, 05:23 AM
I modified the code in welcome.php as you said.

---------------------------------------------------------------------------------
<?php
echo( "Welcome to our Web site, $HTTP_GET_VARS['name']!" );
?>
----------------------------------------------------------------------------------

It says "Undefined index: 'name' ".


By the way ,
Do you study PHP with "http://www.sitepoint.com/article/528/4" like me?