|
Posted by Moot on 05/21/07 20:28
On May 21, 1:17 pm, damezumari <jannordgr...@gmail.com> wrote:
> // trim the parameters
> foreach($_POST as $varname => $value) {$varname = trim($value);}
>
> // give them $p_ prefix
> import_request_variables('gp', 'p_');
>
> When I do the above the parameters are not trimmed in the end.
>
> Example:
>
> $lastname = ' ' is trimmed to $lastname = '', but $p_lastname = ' '
In short, because $varname and $value are local copies of $_POST and
are not pointers to the original variable.
$varname is indeed getting trimmed, but you're overwriting that value
each time through the foreach loop, leaving $_POST['varname']
untouched.
[Back to original message]
|