양식 제출 핸들러는을 사용 drupal_set_message()하거나로 로그에 메시지를 쓰는 메시지 만 인쇄 할 수 있습니다 watchdog().
대안은 필요한 데이터를 세션에 저장하고을 사용하여 사용자를 $form_state['redirect'] = 'page path';세션의 내용이 표시된 페이지로 리디렉션하는 것 입니다.
function firstmodule_menu() {
$items['the path for your page'] = array(
'page callback' => 'firstmodule_show_submitted_data';
// ...
);
return $items;
}
function firstmodule_form1_submit($form, &$form_state) {
$_SESSION['firstmodule_username'] = $username;
// ...
$form_state['redirect'] = 'the path for your page';
}
function firstmodule_show_submitted_data() {
// Populate $result with the string to show.
return $result;
}
참고로, 첫 번째 인수 t()는 리터럴 문자열이어야하며 두 문자열을 연결하는 문자열이 아닙니다. 다음 코드와 같이 자리 표시자를 사용해야합니다.
drupal_set_message(t("The user is %username", array('%username' => $username)));
Drupal 7에서는 문자열을 반환하는 대신 렌더 배열을 반환 할 수 있습니다 .