title: Problems with Forms => Variables are not accepted in the form
body: <p>Not sure where the problem is in the following form used in a template file in Drupal7. Help is highly appreciated. The problems are the following:<br>
  1. The variables $title and $surname are not passed over to the form's default value.<br>
     => Error Message: Notice: Undefined variable: title in form_user_information()<br>
     => Error Message: Notice: Undefined variable: surname in form_user_information()<br>
  2. There's a Warning: strpos() expects parameter 1 to be string, array given in drupal_strip_dangerous_protocols()<br><br>
  Thanks in advance.</p>
  
  <pre><code>   &lt;?php
          //Load User data:
              global $user;
              $uid = $user-&gt;uid;
              $account = user_load($uid); 
  
          //Get User data:
              $title = 'Mrs.';
                  print $title . '&lt;br&gt;&lt;br&gt;'; //Result: Value is printed and not empty!        
              $surname = check_plain($account-&gt;field_vorname['und']['0']['value']);
              //$surname = 'Tom';
                  print $surname . '&lt;br&gt;&lt;br&gt;'; //Result: Both values are printed and are not empty!
  
  
  
          function form_user_information($form, &amp;$form_state) {
  
  
          //Form
              $form['#action'][] = request_uri();
              $form['#id'][] = 'form_user_information';
              $form['#validate'][] = 'form_user_information_validators';
              $form['#submit'][] = 'form_user_information_submit';
              $form['#prefix'] = '&lt;div id="form_user_information"&gt;';
              $form['#suffix'] = '&lt;/div&gt;';
  
              //Select-Field: https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#select
              $form['Title'] = array(
                  '#type' =&gt; 'select',
                  '#title' =&gt; t('Title'),
                  '#options' =&gt; array(
                    'Frau' =&gt; t('Mr.'),
                    'Herr' =&gt; t('Mrs.'),
                  ),
                  '#default_value' =&gt; $title,
              );  
  
              $form['surname'] = array(
                  '#type' =&gt; 'textfield',
                  '#maxlength' =&gt; 50,
                  '#size' =&gt; 40,
                  '#required' =&gt; TRUE,
                  '#title' =&gt; t('Surname'),
                  //'#attributes' =&gt; array('placeholder' =&gt; $surname),
                  '#default_value' =&gt; $surname,
              );
  
              $form['actions'] = array('#type' =&gt; 'actions');
              $form['actions']['submit'] = array('#type' =&gt; 'submit', '#value' =&gt; 'Confirm data');
  
          return $form;
          }
  
  
          //print form
              $form = drupal_get_form('form_user_information');
              print drupal_render($form);
  
          //Form Validation:
          function form_user_information_validators($form, &amp;$form_state) {
            if ($form_state['values']['surname'] == '') {
              form_set_error('surname', t('Please enter your surname.'));
            }
          }
  
          //Form Submit:
          function form_user_information_submit($form, &amp;$form_state) {
  
              //...
  
          }
  
      //get form information
          echo "&lt;pre&gt;".print_r($form,true)."&lt;/pre&gt;";  
  
      ?&gt;
  </code></pre>