function addround(&$smarty) { $id = trim($_POST['tour_id']); $sid = trim($_POST['round_id']); $round_no = trim($_POST['round_no']); $_POST['time1'] = $_POST['time1'] == "" ? "00" : $_POST['time1']; $_POST['time2'] = $_POST['time2'] == "" ? "00" : $_POST['time2']; $round_datep = $_POST['round_date'] . " " . $_POST['time1'] . ":" . $_POST['time2'] . ":00"; $weather = trim($_POST['round_weather']); $rule = trim($_POST['round_playrule']); $note = trim($_POST['notes']); $tour = new tournaments($id); if ($sid == "") { $tour->add_round($round_no, $round_datep, $weather, $rule, $note); } else { $tour->update_round($sid, $round_no, $round_datep, $weather, $rule, $note); } return $id; }