You will probably have to use:
$_POST['username'] = strtolower(trim($_POST['username']));
// or
$_GET['username'] = strtolower(trim($_GET['username']));
Depending on the method which you send the form (GET or POST) as the latest version of PHP comes with register_globals off for security reasons. If you want though you can turn in back on, just look for:
register_globals = off
And change it to on, however this is not recommended. Here are some articles related to this issue.
http://www.php.net/manual/en/security.registerglobals.php
http://www.linuxjournal.com/article.php?sid=6559
http://www.developer.com/lang/article.php/918141
Though there are ways to code securely with register_globals on.