I got it working but not sure how. I basically started over, and everything worked.
I did want to pass the $_POST to the function but as the variable called.
so literally the function would be
get_username($_POST['username'])
I tired as a variable and it woudl not work, but when I put what the value should be in the variable it did work.
However, it is working fine now I must ahve had a typo somewhere as not that I have rebuilt it it works as needed.
Thanks,
Josh