It sounds like you're not properly checking your variables before you use them. For example, this:
$username = $_POST['username']
will cause a notice to be generated (as above) if there is no 'username' array index in the $_POST array (e.g. if the user hasn't submitted a form yet). The proper way to define such a variable would be something like:
$username = (isset($_POST['username']) ? $_POST['username'] : '');
You could also do something like:
if(!empty($_POST)) {
// do all processing with $_POST variables here
}
Finally, display_errors should always be turned Off on a production server since you should be tracking your errors in some other manner, e.g. by using the log_errors directive. I've always recommended fixing coding rather than just turning down error_reporting until the errors "go away."