title: Getting Submitted Post values in Drupal 7
body: <p>I'm having problems accessing the posted values after a form submission with Drupal 7.</p>
  
  <p>Say I have a simple form with one text field and a submit button.</p>
  
  <pre><code>function sample_form($form, &amp;$form_state){
    $form['sample']['name'] = array(
    '#description' =&gt; 'Name',
    '#value' =&gt; 'Name',
    '#type' =&gt; 'textfield',
    );
   $form['sample']['sample_submit'] = array(
     '#type' =&gt; 'submit',
     '#value' =&gt; 'SUBMIT',
     '#submit' =&gt; array('sample_form_submit')
   );
  }
  </code></pre>
  
  <p>and then my submit handler, which is meant to display the value the user entered in the textfield.</p>
  
  <pre><code>function sample_form_submit($form, &amp;$form_state){
    drupal_set_message($form_state['values']['name']);
  }
  </code></pre>
  
  <p>However, the message always contains the default value for the textfield, in this case 'name'. If I enter "Mike" and hit submit, the message displays "name" (the default value). </p>
  
  <p>How can I get at the submitted values? I know I can access with</p>
  
  <pre><code>$form_state['input']['name']
  </code></pre>
  
  <p>but my understanding is that the above gives me the raw, unsanitized $_POST data. </p>
  
  <p>I need the user entered value, how can I get this? I'm really unclear about the process of getting user submitted data using the drupal forms API.</p>
  
  <p>Thanks for any help! </p>