How to load field value to custom form? I'm using Drupal 7 for my website. 
I created custom settings page with custom form in it, but the problem is I don't know proper way to load inserted value from database to my form after saving it, and every time I write something in it, information is written to database, but form is empty.
My code looks like this for this:

function registration_pdf_form($form, $form_state) {
    $form['registration_body_twoside'] = array(
        '#type' =&gt; 'text_format',
        '#title' =&gt; t('Two-sided PDF'),
    );
    $form['registration_body_threeside'] = array(
        '#type' =&gt; 'text_format',
        '#title' =&gt; t('Three-sided PDF'),
    );
    $form['actions'] = array(
        '#type' =&gt; 'actions'
    );
    $form['actions']['submit'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; t('Save settings')
    );
    return $form;
}
function registration_pdf_form_submit($form, $form_state){
    $values = array(
        'reg_twoside' =&gt; $form_state['values']['registration_body_twoside']['value'],
        'reg_threeside' =&gt; $form_state['values']['registration_body_threeside']['value'],
    );
    $insert = db_update('pdf_settings')
        -&gt; fields(array(
            'reg_twoside' =&gt; $form_state['values']['registration_body_twoside']['value'],
            'reg_threeside' =&gt; $form_state['values']['registration_body_threeside']['value'],
        ))
        -&gt;execute();
    drupal_set_message(t('Settings have been saved'));
}


How do I get values to my fields from database?
You can try using system_settings_form which is simple way of storing settings in Drupal..

function registration_pdf_form($form, &amp;$form_state) {
   $form['registration_body_twoside'] = array(
        '#type' =&gt; 'text_format',
        '#title' =&gt; t('Two-sided PDF'),
        '#default_value' =&gt; variable_get('registration_body_twoside', ''),
    );
    $form['registration_body_threeside'] = array(
        '#type' =&gt; 'text_format',
        '#title' =&gt; t('Three-sided PDF'),
        '#default_value' =&gt; variable_get('registration_body_threeside', ''),
    );
  return system_settings_form($form);
}


you can read values using

$twoside = variable_get('registration_body_twoside', '');
$threeside = variable_get('registration_body_threeside', '');