Re: newbie question on variables in php
| From: | O. | Date: | Tue, 25 Jul 2000 17:15:14 +0000 |
| Subject: | Re: newbie question on variables in php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8092@lists.php.net to get a copy of this message | ||
"David Banning" <David@www3.pacific-pages.com> wrote in message
news:397DC73C.AA078E2A@www3.pacific-pages.com...
> I'm studying a php/mysql package I downloaded called freemed.
> I am wondering how a specific variable gets set which is called $db
>
> I can't see how it gets set anywhere in the program.
> I did a grep -a \$db and I got;
It can be set in a couple different ways, most likely as a variable from the
previous form. If a form is submitted with its ACTION="somedoc.php", all of
the data in the controls on the form is parsed by PHP into variables of the
same name as the control.
Thus, <INPUT TYPE="text" NAME="db"> will cause the creation of a variable
called $db in the PHP script that the form is submitted to.
You can also set variables by using the $GLOBALS array, which contains all
the variables in the form of $GLOBALS["variablename"] = variablevalue.
--
O.