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.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to