there's a slightly better way:
if you want to display data that should ne non-editable but still readable, why not print it as it is, eg:
echo "You're logged in as: ".$username;
If you additionally want to pass the value in a form, use a hidden (invisible) input:
echo "<input type=hidden name=username value=\"$username\">";
alternatively you could use cookies or session variables in some cases.