Superglobals for form info and with header()
| From: | Adrian Greeman | Date: | Sun, 16 Jun 2002 10:34:28 +0000 |
| Subject: | Superglobals for form info and with header() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102583@lists.php.net to get a copy of this message | ||
I am a newbie and was confused for a while by Superglobals because I had to
amend all the examples in my books. (Lots of beginners stuff is about taking
in information from forms straight into variables with the same name as the
form input).
I think the answer is essentially to relace the example variables with
$_POST["VariableName"] or $_GET["VariableName"] instead of using directly
$VariableName.
Or perhaps to read the value from the array into some other new variable.
This did cause me a problem when bringing in a number - the answer seemed
to be to define the new variable as an integer.
$NewVariable=(int)S_POST["VariableName"] seems to be right. But I am not
sure I understand why it is more secure.
Two questions -
1. Is this more or less right and what else do I need to do to work the new
system in all my examples? (I want to learn the 4.2 way from the beginning).
2. Does the new Superglobal arrays way of doing things apply if I transfer
information over using header()?