如何访问drupal 7中hook_form_validate()中的表单数据

如何访问drupal 7中hook_form_validate()中的表单数据,drupal,drupal-7,drupal-modules,Drupal,Drupal 7,Drupal Modules,我有一个从hook_form实现的表单,名为simplequiz_form(),我想在提交后访问它的数据,下面是我编写的代码,但我似乎无法在提交后访问它的数据。我做错了什么 function simplequiz_form_validate($form, &$form_state) { // here is where we will validate the data and save it in the db. $thid = db_insert('simplequiz') -&

我有一个从hook_form实现的表单,名为simplequiz_form(),我想在提交后访问它的数据,下面是我编写的代码,但我似乎无法在提交后访问它的数据。我做错了什么

function simplequiz_form_validate($form, &$form_state) {
// here  is where we will validate the data and save  it in the db.
$thid = db_insert('simplequiz')
->fields(array(

'questions' => &$form_state['question'],
**I can't seem to access the value of a field questions** 

))
->execute();

 return $thid;
 }
下面是我对hook_form()的实现。

如果我使用$form_state['values']['question']

我得到以下错误:

PDOException:SQLSTATE[21S01]:插入值列表与列列表不匹配:1136列计数与第1行的值计数不匹配:插入到{simplequiz}(问题)值(:db_插入_占位符_0_值,:db_插入_占位符_0_格式);simplequiz_form_submit()(home/vishal/Dropbox/sites/dev/sites/all/modules/simplequiz/simplequiz.module的第245行)中的数组([:db_insert_占位符_0_值]=>[:db_insert_占位符_0_格式]=>


它使用$form\u state['values']['question']['value']使用
hook\u form\u validate
是最佳实践,仅出于验证目的,验证以外的任何操作都应在
hook\u form\u submit
中完成

无论哪种方式,它们的功能几乎相同


所有表单数据都存储在
$form\u state['values']
中,因此要访问
$form['questions']
值,只需使用
$form\u state['values']['question'][/value']就可以了,不过$form\u state['values']['question'][/value']只是一句话:没有钩子表单验证()。这称为“表单验证处理程序”。
function simplequiz_form($form, &$form_submit)
{ 

$form['question'] = array(
'#title' => t('Please input your question'),
'#type' => 'text_format',
'#required' => FALSE,
'#description' => t('Here is where you can enter your questions'),    
);

$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;

}