I am teaching myself PHP with “Beginning PHP4, (WROX)” and for the life of me I can’t get this to work and I don’t see anything wrong. This example is from the book.
Who is your favorite author?
-------------------------------------------------
Your favorite author is:
<?php
echo $author;
?>
------------------------------------------------
If I type g-r-e-e-n and press submit .....
I get Your favorite author is: b-l-a-n-k
The value of the variable is never printed.
My browser is Firefox. I've double and triple checked the spelling.
Your book expects register_globals to be enabled. This poses a security hole however, and has been disabled by default since PHP4.? somewhere halfway PHP4. You’ll want to catch your external values using the $_GET superglobal:
echo $_GET['author'];
Most forms use ‘method=“POST”’ though, in which case $_POST should be used.
I have a similar problem while i accept a name in HTML and print in PHP code. I tried the echo $_GET[‘DATA’]; and also echo $_POST[‘DATA’]; options. No output for me.