How to autofill text fields in form?
You should check out https://drupal.stackexchange.com/a/54387/4387 

function MYMODULE_some_form($form, &amp;$form_state) {
  // If the form has been submitted, output something related to the submission
  if (!empty($form_state['values']['some_field'])) {
    // Get data from database and show second step fields.
    $form['user_name'] = array(
      '#type' =&gt; 'textfield',
      // ...
    );

  }
  else {
    // Otherwise build the normal form (first step).
    $form['user_id'] = array(
      '#type' =&gt; 'textfield',
      // ...
    );
  }

  return $form;
}

function MYMODULE_some_form_submit($form, &amp;$form_state) {
  $form_state['rebuild'] = TRUE;
}