Auto fill the username in an form, how?

I need help with this. I have a form for add new users. But I don’t want users to change the Title - I want to auto fill the username they have already. Right now it look like the picture. But I want to echo getUsername(); Any one can help me with this? Please!

Here is my form code now. Any one? Please!

 ),
'title' => array(
'type' => 'text',
'name' => 'title',
'caption' => _t('_modzzz_model_form_caption_title'),
'value' => $sDefaultTitle,
'required' => true,
'checker' => array (
'func' => 'length',
'params' => array(3,$this->_oMain->_oConfig->getTitleLength()),
'error' => _t ('_modzzz_model_form_err_title'),
),
'db' => array (
'pass' => 'Xss',
),
'display' => true,
), 

The code you posted is just a piece of an array, and I guess you’re using some kind of framework to create the form?

Anyway, you might try to change this line

'value' => $sDefaultTitle, 

in

'value' => getUsername(), 

If, after the form is filled with what you want, and you don’t want them to be able to change it then make the input Readonly

<form action="demo_form.asp">
  Country: <input type="text" name="country" value="Norway" [B]readonly[/B]><br>
  <input type="submit" value="Submit">
</form>

Thaink you! This worked fine. It retrieves the user name now. but the user can still change the name. See the picture. Can I change so that they can not change the name now? I did tried to insert IF to this but i can’t get it to work. I get error.

My code look like this now. It working fine now. But they can change the username now. How can i input IF to this.

),
‘title’ => array(
‘type’ => ‘text’,
‘name’ => ‘title’,
‘caption’ => _t(‘_modzzz_model_form_caption_title’),
‘value’ => getUsername(),
‘required’ => true,
‘checker’ => array (
‘func’ => ‘length’,
‘params’ => array(3,$this->_oMain->_oConfig->getTitleLength()),
‘error’ => _t (‘_modzzz_model_form_err_title’),
),
‘db’ => array (
‘pass’ => ‘Xss’,
),
‘display’ => true,
),

I don’t know if/how that is possible in the framework you’re using