You are here

function mp3player_player_form_submit in MP3 Player 6.2

Same name and namespace in other branches
  1. 7.2 mp3player.module \mp3player_player_form_submit()

form_submit

File

./mp3player.module, line 537
mp3player main module file.

Code

function mp3player_player_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  if (array_key_exists('pid', $values) && $values['pid'] > 1) {
    drupal_write_record('mp3player_players', $values, 'pid');
    drupal_set_message(t("MP3 Player %name updated.", array(
      '%name' => $values['name'],
    )));
  }
  else {
    if (array_key_exists('pid', $values)) {
      unset($values['pid']);
    }
    drupal_write_record('mp3player_players', $values);
    drupal_set_message(t("New MP3 Player %name added.", array(
      '%name' => $values['name'],
    )));
  }
  $form_state['redirect'] = 'admin/settings/mp3player';
}