how to update the form values after pressing the submit button Below I have written code for update but when I change the value in form and press submit button still those old values goes to the database. My question is how to get current edited value of my form after it is displayed?

function upgrade_menu(){
    $items = array();
    $items['upgrade_page'] = array(
    'title' =&gt; t('Upgrade'),
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array(' upgrade_update'),
    'access callback' =&gt; TRUE,
    );
    return $items;
}

function upgrade_page($form, &amp;$form_state) {
    if (!isset($form_state['storage']['upgrade_module']['search_criteria'])) {
        return drupal_get_form('upgrade_form');
    }
    $title = $form_state['input']['Name'];
    $query = db_select('form_test', 'n')
    -&gt;condition('name', $title, '=')
    -&gt;fields('n',array('name','Id','age','email','salary'));
    $results = $query-&gt;execute();
    $res = $results-&gt;fetchAssoc();  
    $form['Name'] = array(
        '#title' =&gt; t('Name'),
        '#type' =&gt; 'textfield',
        '#value' =&gt; $res['name'],
    );  
    $form['Id'] = array(
        '#title' =&gt; t('Id'),
        '#type' =&gt; 'textfield',
        '#value' =&gt; $res['Id'],
    );  
    $form['Age'] = array(
        '#title' =&gt; t('Age'),
        '#type' =&gt; 'textfield',
        '#value' =&gt; $res['age'],
    );
    $form['Emailid'] = array(
        '#title' =&gt; t('Emailid'),
        '#type' =&gt; 'textfield',
        '#value' =&gt; $res['email'],  
    );
    $form['Salary'] = array(
        '#title' =&gt; t('salary'),
        '#type' =&gt; 'textfield',
        '#value' =&gt; $res['salary'],   
    ); 
    $form['submit'] = array(
        '#value' =&gt; 'Update',
        '#type' =&gt; 'submit',
        '#submit' =&gt; array('upgrade_update'),
    );
    return $form;
}

function upgrade_form($form, &amp;$form_state) {
    $form['criteria'] = array(
        '#type' =&gt; 'fieldset',
        '#title' =&gt; 'Update',
        '#attributes' =&gt; array('class' =&gt; array('container-inline')),
    );
    $form['criteria']['Name'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Name'),
        '#value' =&gt; (isset($form_state['input']['Name'])) ? $form_state['input']['Name'] : "",
        '#size' =&gt; 10,
        '#maxlength' =&gt; 20,
    );
    $form['criteria']['submit'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; 'search',
        '#submit' =&gt; array('upgrade_submit'),
    );
    return $form;
}

function upgrade_submit($form, &amp;$form_state) {
    $form_state['storage']['upgrade_module']['search_criteria'] = $form_state['values'];
    $form_state['rebuild'] = TRUE;
}

function upgrade_update($form, &amp;$form_submit) {
    $name =  $form_submit['values']['Name'];
    $Id = $form_submit['values']['Id'];
    $age = $form_submit['values']['Age'];
    $email = $form_submit['values']['Emailid'];
    $salary = $form_submit['values']['Salary'];
    drupal_set_message(t('You provided a  name',array('name' =&gt; $name)));
    drupal_set_message(t('You provided a  Id',array('Id' =&gt; $Id)));
    drupal_set_message(t('You provided a  age',array('age' =&gt; $age)));
    drupal_set_message(t('You provided a  email',array('email' =&gt; $email)));
    drupal_set_message(t('You provided a salary',array('salary' =&gt; $salary)));

    $entry = array(
        'name' =&gt; $form_submit['values']['Name'],
        'id' =&gt; $form_submit['values']['Id'],
        'age' =&gt; $form_submit['values']['Age'],
        'email' =&gt; $form_submit['values']['Emailid'],
        'salary' =&gt; $form_submit['values']['Salary'],
    );
    $table = 'form_test';
    $return_value = db_update($table)
    -&gt;fields($entry)
    -&gt;condition('email',$email,'=')
    -&gt;execute();   
    print drupal_set_message('Database is successfully Updated..');
    return $return_value;
}
You're mixing up #value and #default_value. If you want to show information in the form but let the user change it, you need to use #default_value. If you want the information to always be the same, and never let the user change it, use #value.