Forums
This topic is locked
Notice: Undefined variable -- Rookie Q
Posted 21 Jun 2003 10:07:53
1
has voted
21 Jun 2003 10:07:53 Norman Buangan posted:
I'm completely new to PHP and I'm going through my Wrox PHP book. I'm learning about variables. Here's the code that I'm using and the error message I'm getting. Is there something wrong with my PHP configuration? If so, what do I have to change. I checked the forum for something similar but maybe subject is easy to solve for most. Thanks in advanced.<html>
<form>
Please type your name here:<br />
<input type=text name=username><br><br>
<input type=submit value="Submit Data">
</form>
<br><br>
You typed:
<?php
echo($username);
?>
</html>
The error is:
Notice: Undefined variable: username in C:\home\httpd\html\wrox\variables.php on line 11
Replies
Replied 21 Jun 2003 17:00:38
21 Jun 2003 17:00:38 Norman Buangan replied:
Forgot to mention what I'm running:
- IIS on Win XP
- PHP 4
- MySQL 4
- IIS on Win XP
- PHP 4
- MySQL 4
Replied 21 Jun 2003 17:37:49
21 Jun 2003 17:37:49 kamm k replied:
Instead of
echo($username);
try
echo $HTTP_GET_VARS['username'];
This has to do with register globals being turned off in the latest versions of PHP.
de2.php.net/register_globals
echo($username);
try
echo $HTTP_GET_VARS['username'];
This has to do with register globals being turned off in the latest versions of PHP.
de2.php.net/register_globals