$conn_ategory->addSubject($subject_id, $sub_id, $category_id, $addData); $returnMesg = "學科輸入成功"; } } } } else { if ($_POST["submitType"] == "新增章") { $jsubject = $_POST["postSubject"]; $pieces = explode("-", $jsubject); $subject_id = $pieces[0]; $sub_id = $pieces[1]; //print_r($jsubject); if (empty($subject_id)) { $returnMesg = "請重新選擇學科"; } else { $conn_ategory->addChapter($subject_id, $sub_id, $addData); $returnMesg = "章輸入成功"; } } else { if ($_POST["submitType"] == "新增節") { $jsubject = $_POST["postSubject"]; $jchapter = $_POST["postChapter"]; $pieces = explode("-", $jsubject); $subject_id = $pieces[0]; $sub_id = $pieces[1]; //print_r($jsubject); if (empty($jchapter)) { $returnMesg = "請重新選擇章"; } else { if (empty($jsubject)) { $returnMesg = "資料不齊全";