Why don't calls to drupal_set_message() show up after a drupal_goto()? My question is similar to How to  redirect the user to a  page and show a message on the admin overlay (using drupal_set_message and drupal_goto), but I'm not doing an overlay -- it's just a straight page.  This issue has been talked around a bit on this site, but I've never seen a real resolution of it.

My situation is:


The user submits a form, through the usual method. 
The form has a _submit() handler, which runs: it does some stuff,
sets a drupal_set_message(), and then redirects somewhere via
drupal_goto().
The user properly ends up on the intended page, but the message is
nowhere to be seen.


Any clues on this?  I really can't figure out why this is happening.
I tried in my test site, and the message appears, even using drupal_goto(). I used the following code.

function code_testing_date_form($form, &amp;$form_state) {
  $form['expire'] = array(
    '#type' =&gt; 'date_select',
    '#title' =&gt; t('Expire Date'),
    '#default_value' =&gt; date('Y-m-d H:i:s'),
    '#date_format' =&gt; 'Y-H:s',
    '#date_year_range' =&gt; '0:+20',
    '#required' =&gt; TRUE,
  );

  $form['weight'] = array(
    '#type' =&gt; 'weight',
    '#title' =&gt; t('Weight'),
    '#description' =&gt; t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
    '#default_value' =&gt; 5,
    '#delta' =&gt; 10,
    '#access' =&gt; FALSE,
  );

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Submit'),
  );

  return $form;
}

function code_testing_date_form_submit($form, &amp;$form_state) {
  drupal_set_message('You have been redirected.');
  drupal_goto('user');
}




What could cause the issue you are seeing could be:


There is code that clears the content of $_SESSION['messages'], used to contain the messages set with drupal_set_message().
There is code that invalidate the current session. In this case, the logged-in user should be logged out.
You are rendering the form in a template file.
The template file for the page to which the users are redirected doesn't have code to handle the $messages variable. The default node.tpl.php file contains the following code; if the template doesn't print $messages, the messages set with drupal_set_message() will be not seen.

&lt;?php if ($breadcrumb): ?&gt;
  &lt;div id="breadcrumb"&gt;&lt;?php print $breadcrumb; ?&gt;&lt;/div&gt;
&lt;?php endif; ?&gt;
&lt;?php print $messages; ?&gt;
&lt;div id="main-wrapper"&gt;&lt;div id="main" class="clearfix"&gt;