You are here

function dbtng_example_form_update_submit in Examples for Developers 7

Submit handler for 'update entry' form.

Related topics

File

dbtng_example/dbtng_example.module, line 612
This is an example outlining how a module can make use of the new DBTNG database API in Drupal 7.

Code

function dbtng_example_form_update_submit($form, &$form_state) {
  global $user;

  // Save the submitted entry.
  $entry = array(
    'pid' => $form_state['values']['pid'],
    'name' => $form_state['values']['name'],
    'surname' => $form_state['values']['surname'],
    'age' => $form_state['values']['age'],
    'uid' => $user->uid,
  );
  $count = dbtng_example_entry_update($entry);
  drupal_set_message(t("Updated entry @entry (@count row updated)", array(
    '@count' => $count,
    '@entry' => print_r($entry, TRUE),
  )));
}