Dear Drupal community,

I am pretty much lost with the form listed below. When calling the form funnyform via the function funny_function (via the menu link 'Funny'), the form appears, and the word 'Fun' is displayed as I programmed. Now, when I click on the 'Resume' button, the word 'Submitted' is obviously displayed. However, the word 'Fun' appears as well. Apparently, Drupal goes back into this function once again! Now, this is very bad news because in my "real-life" this function contains additional programming code which is then run twice...

Can anybody please help me how to stop Drupal from going back there? And explain to me why it even does so??

Thanks and best wishes, Tobias

$items['funny'] = array(
  'title' => t('Funny'),
  'page callback' => 'funny_function',
  'access callback' => TRUE,
  'type' => MENU_NORMAL_ITEM,

function funny_function() {
  return drupal_get_form('funnyform');

function funnyform($form, &$form_state) {
  $form['information'] = array(
    '#markup' => t('Nothing'),

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Resume'),
    '#weight' => '100',
  return $form;

function funnyform_submit($form, &$form_state) {
  $form_state['redirect'] = 'another_funny_page';

1 Answer 1


Where else would you expect the form to lead?

You can add ?destination=somepath to the URL, or a #redirect to the submit array, or a drupal_goto in the funnyform_submit() function, but if you don't tell Drupal where to go, it's just going to reload the current page.

  • In my "real" form I am using a $form_state['redirect'], it makes no difference. Drupal still hits the original page first...
    – tobias
    Commented Feb 23, 2012 at 1:41

Your Answer

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

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