I'm trying to create a custom form in Drupal 6 and everything seems to work okay with the code below including when submitted a new entry is created in the database however all the $form_state values are empty. What am I missing?
<?php
function rate_form($form_state) {
$form = array();
$form['rate']['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#size' => 30,
'#maxlength' => 100,
'#required' => TRUE,
);
$form['rate']['description'] = array(
'#type' => 'textarea',
'#title' => t('blah, blah'),
'#maxlength' => 1500,
);
$form['rate']['submit'] = array('#type' => 'submit', '#value' => t('Rate!'));
return $form;
}
print drupal_get_form($form_id);
function rate_form_submit($form_id, &$form_state) {
db_query("INSERT INTO {rate_comments} (name, description) VALUES ('%s', '%s')", $form_state['values']['rate']['name'], $form_state['values']['rate']['description']);
drupal_set_message(t('Thank you! Your rating has been added.'));
}
?>