header('Location: '.$ROOTURL.'question_add.php?item_id='.$_POST["jitem"]); exit; } */ //print_r($_POST);exit; $page_title = "新增類別"; if (!empty($_POST["jcategory"])) { $jcategory = $_POST["jcategory"]; $result = $conn_ategory->getCategoryList($_POST["jcategory"]); $submit_name = "學科"; $page_title = "新增學科"; } if (!empty($_POST["jsubject"])) { $jsubject = $_POST["jsubject"]; $pieces = explode("-", $jsubject); $subject_result = $conn_ategory->getSubjectList($pieces[0], $pieces[1]); $submit_name = "章"; $page_title = "新增章"; } if (!empty($_POST["jchapter"])) { $jchapter = $_POST["jchapter"]; $chapter_result = $conn_ategory->getChapterList($jchapter); $submit_name = "節"; $page_title = "新增節"; } if (!empty($_POST["jsection"])) { $jsection = $_POST["jsection"]; $section_result = $conn_ategory->getSectionList($jsection); $submit_name = "小節"; $page_title = "新增小節"; }
<?php include_once "include/db.php"; include_once "include/func_category.php"; $conn_ategory = new Category(); $result = $conn_ategory->getCategoryList(''); $subject_result = $conn_ategory->getSubjectList('', ''); $chapter_result = $conn_ategory->getChapterList(''); $section_result = $conn_ategory->getSectionList(''); $part_result = $conn_ategory->getPartList(''); $item_result = $conn_ategory->getItemList(''); //print_r($part_result); //exit; $arr_subject = array(); foreach ($subject_result as $key => $val) { $id = $val["subject_id"] . "-" . $val["sub_id"]; $arr_subject[$val["category_id"]][$id] = $val["subject_name"]; } $arr_chapter = array(); foreach ($chapter_result as $key => $val) { $subject_id = $val["subject_id"] . "-" . $val["sub_id"]; $arr_chapter[$subject_id][$val["chapter_id"]] = $val["chapter_name"]; } $arr_section = array(); foreach ($section_result as $key => $val) { $arr_section[$val["chapter_id"]][$val["section_id"]] = $val["section_name"]; } $arr_part = array(); foreach ($part_result as $key => $val) { $arr_part[$val["section_id"]][$val["part_id"]] = $val["part_name"]; }
<?php include_once "include/db.php"; include_once "include/func_category.php"; $conn_ategory = new Category(); //print_r($_POST);exit; if ($_POST["submitType"] == "editQuestion") { $page_title = "修改題目"; $question_id = $_POST["postQ"]; $question_result = $conn_ategory->getQuestionList($question_id, '', '', '', '', '', '', ''); $exam_id = $question_result[0]["exam_id"]; $q_item_id = $question_result[0]["item_id"]; //print_r($question_result);exit; $question_item_result = $conn_ategory->getItemList($q_item_id); $question_subject_result = $conn_ategory->getSubjectList($question_item_result[0]["subject_id"], $question_item_result[0]["sub_id"]); $q_category_id = $question_subject_result[0]["category_id"]; $q_subject_id = $question_item_result[0]["subject_id"] . "-" . $question_item_result[0]["sub_id"]; $q_chapter_id = $question_item_result[0]["chapter_id"]; $q_section_id = $question_item_result[0]["section_id"]; $q_part_id = $question_item_result[0]["part_id"]; //$exam_result = $conn_ategory->getExamList($exam_id); //$question_exam_result = $conn_ategory->getExamList(''); } $result = $conn_ategory->getCategoryList(''); $subject_result = $conn_ategory->getSubjectList('', ''); $chapter_result = $conn_ategory->getChapterList(''); $section_result = $conn_ategory->getSectionList(''); $part_result = $conn_ategory->getPartList(''); $item_result = $conn_ategory->getItemList(''); $exam_result = $conn_ategory->getExamList(''); //print_r($part_result);