Forum Moderators: coopster
--text.html--
<html><head></head><body>
<form method=get action="text.php">
Who is your favourite author?
<input name="Author" type="text">
<br><br><input type=submit>
</form></body></html>
--text.php--
<html><head></head><body>
Your favourite Author is:
<?php
echo $Author;
?>
</body></html>
--Error Message--
Notice: Undefined variable: Author in c:\inetpub\wwwroot\book\text.php on line 6
Can anyone fill me in on what may be going wrong?
If you do want to change it:
If this is your own server you can edit php.ini
register_globals offto
register_globals on
php_value register_globals 1
$_GET is automatically global.
On the register_globals thing... I think it's a common misconception that there is a security issue around this. It is not fundamentally a security issue, though it can have some security implications.
The more important issue is code stability. If you accidentally have something like this
<form method="post" action="index.php?filename=show_biography.php">
<input type="text" name="name" value="Bilbo">
<input type="text" name="filename" value="bilbo_biography.html">
....
Now what's the value of $filename in the script? I know for sure that $_POST['filename'] = "bilbo_biography.html" and that $_GET['filename'] = "show_biography.php".
What's $filename though? Fortunately we have some control [php.net] over the situation, but it's still likely to lead to confusion.
Tom