Re: Register_globals = off version of Manuel Lemos's form class?
| From: | Marek Kilimajer | Date: | Wed, 13 Nov 2002 19:41:08 +0000 |
| Subject: | Re: Register_globals = off version of Manuel Lemos's form class? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124291@lists.php.net to get a copy of this message | ||
Even if the method is post, you can have get variables, if the form has action="script.php?get_var=value"
Jason Wong wrote:
On Wednesday 13 November 2002 23:57, Leif K-Brooks wrote:I am planning to use Manuel Lemos's form class for a web site I am working on. However, I need to have register_globals set to off. I was planning to rewrite the portions of the class that access submitted form values directly to use the suberglobal arrays. When I started, though, I saw how big the class was. I'm wondering if anyone else has already done this, and wouldn't mind sharing their code?Here's what I use: function InjectGlobalVars() { $method = $this->METHOD; switch (strtolower($method)) {case "post" : if (isset($_POST)) { foreach ($this->inputs as $name => $value) { if (isset($_POST[$name])) { $GLOBALS[$name] = $_POST[$name]; } } } break; case "get" : if (isset($_GET)) { foreach ($this->inputs as $name => $value) { if (isset($_GET[$name])) { $GLOBALS[$name] = $_GET[$name]; } } } break;} } After I've defined all the form elements I just call the above function.