variable problem


#1

Hi All.
I just start to study PHP. What is wrong in my simple exercise. After execution I got an error: Undefined index: Author in c:Inetpubwwwroottext.php on line 5
TEXT.TXT file is:

[code]

Who is your favorite author?

[/code] TEXT.PHP file is: [code] Your favorite author is: <? echo $Author = $_GET['Author']; ?> [/code] Thanks.

#2

Change the TEXT.TXT file so that the INPUT line for your text is as follows:

<INPUT NAME="Author" TYPE="TEXT">

You have TYPE listed twice (as opposed to a NAME and TYPE), so when you submit it to TEXT.PHP, there is NO variable (or rather index in the Super Global array of $_GET) named “Author” .

So you are trying to assign a value in the array for an index that doesn’t exist into a local variable.