1 dbtng_example.module dbtng_example_form_update_submit($form, &$form_state)

Submit handler for 'update entry' form.

Related topics

File

modules/examples/dbtng_example/dbtng_example.module, line 528
This is an example outlining how a module can make use of the DBTNG database API in Backdrop.

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);
  backdrop_set_message(t("Updated entry @entry (@count row updated)", 
  array('@count' => $count, '@entry' => print_r($entry, TRUE))));
}