You shouldn't use the PASSWORD function in MySQL, it's not for that. You should use the php crypt() function, or something like PHPass. (Which I see you did in your second post, so that's good).
Your salt function could be simplified by using an array, which you can build using array_merge(range('A', 'Z'), range('a', 'z'), range(0,9)).
I would trim everything EXCEPT the password, but not just email. Names too.
Edit: Also you need to work out your logic here:
$fullname = $_POST['firstname'];
if($firstname == '') {
$errors[] = 'Please enter your firstname.';
}
if($lastname == '') {
$errors[] = 'Please enter your lastname.';
}