When I submit forms(all forms) in Drupal 7 it shows the Your configuration settings have been saved message, but the form values are still the same as the values before submission. I have cleared the cache but the problem still exists.

Any suggestion?

  • Yes. It was working...
    – hpn
    Apr 18, 2013 at 7:56
  • 1
    Are you overriding the variables in $conf array, e.g settings.php? Apr 18, 2013 at 10:09
  • @DavidThomas NO!
    – hpn
    Apr 18, 2013 at 10:14
  • Any errors in the watchdog log (admin/reports/dblog)?
    – rooby
    Apr 21, 2013 at 4:48
  • Are you getting the same error when you create new content? Apr 23, 2013 at 10:12

2 Answers 2


I can suggest how you can test what's happening:

  1. Create custom test form with submit function.
  2. Install Xdebug on your LAMP, or WAMP or MAMP
  3. Than watch callstack. look what functions have been called.

Looks you've done some specific changes in your instalation. Also try to download clear drupal instalation and check forms there.

(P.S. If you have opportunity switch to new instalation).


Your form returns not the elements of the form. But your return part of function is something like:

return system_settings_form($form);  

if we look to this function:

function system_settings_form($form) {
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),

  if (!empty($_POST) && form_get_errors()) {
    drupal_set_message(t('The settings have not been saved because of the errors.'), 'error');

  $form['#submit'][] = 'system_settings_form_submit';
  // By default, render the form using theme_system_settings_form().
  if (!isset($form['#theme'])) {
    $form['#theme'] = 'system_settings_form';
  return $form;

Your problem is: $form['#submit'][] = 'system_settings_form_submit'; this adds another submit function to form. And this function saves variables through variable_set() function:

function system_settings_form_submit($form, &$form_state) {
  // Exclude unnecessary elements.

  foreach ($form_state['values'] as $key => $value) {
    if (is_array($value) && isset($form_state['values']['array_filter'])) {
      $value = array_keys(array_filter($value));
    variable_set($key, $value);

  drupal_set_message(t('The configuration options have been saved.'));

So you have to get your settings variables with function variable_get();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.