我的页面上有一些来自数据库的输出数据(在 mytheme_page_preprocess 函数中对 db 的查询很少),我想做搜索表单(文本字段和提交按钮)。那么,如何在预处理函数中获取表单提交的值?
类似于$form_state['values']
myform_form_submit($form, $form_state),但在预处理函数中。
我的简单搜索表格
function reestr_form($form, &$form_state)
{
$form = array();
$form['q'] = array(
'#type' => 'textfield',
'#size' => 30,
'#default_value' => t(''),
);
$form['submit'] = array(
'#type' => 'submit',
//'#value' => 'send',
'#name' => 'op',
'#src' => base_path() . path_to_theme() . '/images/search-button.png',
'#submit' => array('reestr_form_submit')
);
//$form['#submit'][] = 'reestr_search_submit';
return $form;
}
function reestr_form_submit($form, &$form_values)
{
$message = 'You have submitted the ' . $form_id . ' form which contains the following data:<pre>' . print_r($form_values, true) . '</pre>';
var_dump($message);
}