I've created a custom form for my module. Submitting the form does result in the requested changes in the database, but in my browser I only see a blank screen with the URL for the page which held the form, even though I have a redirect in my submit-handler. Below the code for the submit-handler:

function nodeorder_admin_display_form_submit($form, &$form_state) {
  $sql = "UPDATE ...";
  $tid = -1;
  foreach ($form_state['values'] as $node) {
    db_query($sql, ....);
	$tid = $node['tid'];
  }
  drupal_set_message(t('Update succeeded.'));
  cache_clear_all();
  $form['#redirect'] = 'nodeorder/term/' . $tid;
}

I also tried

$form_state['redirect'] = 'nodeorder/term/' . $tid;

but that doesn't work either.

I hope someone can point me in the right direction.

Comments

pvanderspek’s picture

I thought the problem was a missing return-statement but that wasn't it either.

pvanderspek’s picture

I just found the page on the white screen of death and so I looked in error logs of apache and found this:

[error] mod_security: Filtering against POST payload requested but payload is not available

Maybe someone knows how the white screen and the error above are related?

pvanderspek’s picture

Ok, the mod_security error has nothing to do with it. It seems to be happening with other pages as well. Probably a misconfiguration by my provider.

pvanderspek’s picture

I just found the following error in the drupal log

Cannot modify header information - headers already sent by (output started at /home/kerk/domains/mydomain/public_html/drupal-6.8/sites/all/modules/nodeorder/nodeorder.admin.inc:1) in /home/kerk/domains/mydomain/public_html/drupal-6.8/includes/common.inc on line 319.
pvanderspek’s picture

I found the problem. Apparently the files weren't transferred properly to my server and a weird character was inserted before <?php
Removing it, resolved the problem