[development] Disapearing $form_values

ktt kestutis98 at yahoo.com
Fri Feb 12 15:36:47 UTC 2010


Hello,

I have a form:

function contactlistcreate() {
  $form = array();
  
  $form['listname'] = array(
    '#type' => 'fieldset', 
    '#title' => t('Create new list'),
    '#tree' => TRUE,
  );
  $form['listname']['list_name'] = array(
    '#type' => 'textfield', 
    '#title' => t('List name'), 
    '#size' => 30, 
    '#maxlength' => 64, 
    '#description' => t('Enter the list name'),
    '#default_value' => 'dddodododod',
  );
  $form['listname']['description'] = array(
    '#type' => 'textarea', 
    '#title' => t('Describe it'), 
    '#cols' => 60, 
    '#rows' => 5, 
    '#description' => t('List description.'),
  );
  $form['listname']['submit'] = array('#type' => 'submit', '#value' => t('Save'));
  return $form;
}

and submit function:

function contactlistcreate_submit($form_id, $form_values) {
  db_query(
    "INSERT INTO {contactsliststable} (contacts_list_name, contacts_list_description) VALUES ('%s', '%s')", $form_values['list_name'], $form_values['description']);
    drupal_set_message(t('Your list has been saved.'));
}

But it inserts only empty values to database table and throw no errors..


Regards,
Ktt


      


More information about the development mailing list