//+trace dis

// load the standard submit utilities
$this->execPieceByName('ff_InitLib');

// retrieve the submitted values
$recordid = ff_getSubmit('recordid');
$userid   = JFactory::getUser()->get('id',0);
$couple   = ff_getSubmit('couple', '');
$age      = ff_getSubmit('age',    0);
$acro     = ff_getSubmit('acro',   0);
$fun      = ff_getSubmit('fun',    0);
$boogie   = ff_getSubmit('boogie', 0);

if (is_numeric($recordid))
    // update existing record
    ff_query(
        "update `#__rnr_contest` ".
           "set `couple` = '$couple', ".
               "`age`    = '$age', ".
               "`acro`   = '$acro', ".
               "`fun`    = '$fun', ".
               "`boogie` = '$boogie' ".
         "where `id`     = $recordid"
    );
else
    // save new record
    ff_query(
        "insert into `#__rnr_contest` ".
            "(`userid`, `couple`, `age`, `acro`, `fun`, `boogie`) ".
        "values ('$userid', '$couple', '$age', '$acro', '$fun', '$boogie')"
    );