Passing data from form to theme

There is a self-written search module for drupal.
The question is how to pass an array from the my_search_submit function to a function that displays information on the screen.
The essay is below. There must definitely be a normal way, but I can’t find it.

  //Описание блоков
   function my_search_hblock($op = 'list', $delta = 0, $edit = array()){
   switch ($op) {
   case 'list':
   $blocks[0] = array(
       'info' => t('Поиск GM'),
   $blocks[1]= array(
       'info' =>t('Результат поиска'),
   return $blocks;
   case 'view':
   switch ($delta) {
     case 0:
     $block['content'] = my_search_page();//форма для поиска
     case 1:
     $block['content'] = my_search_result_contents();//результат поиска
   return $block;
   //Сам сабмитер
   function my_search_form_submit($form, &$form_state){
   //некоторый код
 function container($result=NULL){
  * Это что-то типа контейнера 
  * Если в функцию передана переменная--то её данные заносятся в сессию
  * Если ничего не переданно--то из сссии извлекаются данные, сама сессия обнуляться.
        return $result;
  function my_search_result_contents(){
    $output = theme('search', $result);
    return $output;

Answer 1, authority 100%

Actually, the question is closed. The lead programmer came and said that immediately after the submitter comes the hiader. So the data really needs to be pushed into the session and used. At the same time, he showed the scheme of how the form works in “Pro Drupal Development”. There was also an option to shift all the work with processing to Ajax or JayQuery, and the submitter will do echo html. Who has the rights to close the topic, pliz.

Leave a reply

Please enter your comment!
Please enter your name here