<?php 
	ob_start();
	require_once("../includes/initialize.php"); 
	date_default_timezone_set('Asia/Calcutta');

	echo "Helll0";

	foreach ($_POST as $key => $value) {
		echo htmlspecialchars($key)." = ".htmlspecialchars($value)."<br>";
	}


	$questions_set = new QuestionsSet();

	$questions_set->category 		= $_POST['category']; 
	$questions_set->questions 		= $_POST['questions']; 
	$questions_set->a 		 		= $_POST['a']; 
	$questions_set->b 		 		= $_POST['b']; 
	$questions_set->c 		 		= $_POST['c']; 
	$questions_set->d 		 		= $_POST['d']; 
	

	if($_POST['ans_key'] == "a"){ $questions_set->answer = $_POST['a']; }
	if($_POST['ans_key'] == "b"){ $questions_set->answer = $_POST['b']; }
	if($_POST['ans_key'] == "c"){ $questions_set->answer = $_POST['c']; }
	if($_POST['ans_key'] == "d"){ $questions_set->answer = $_POST['d']; }

	$questions_set->ans_key 		= $_POST['ans_key']; 



	$questions_set->hi_questions 		= $_POST['hi_questions']; 
	$questions_set->hi_a 		 		= $_POST['hi_a']; 
	$questions_set->hi_b 		 		= $_POST['hi_b']; 
	$questions_set->hi_c 		 		= $_POST['hi_c']; 
	$questions_set->hi_d 		 		= $_POST['hi_d']; 
	

	if($_POST['hi_ans_key'] == "hi_a"){ $questions_set->hi_answer = $_POST['hi_a']; }
	if($_POST['hi_ans_key'] == "hi_b"){ $questions_set->hi_answer = $_POST['hi_b']; }
	if($_POST['hi_ans_key'] == "hi_c"){ $questions_set->hi_answer = $_POST['hi_c']; }
	if($_POST['hi_ans_key'] == "hi_d"){ $questions_set->hi_answer = $_POST['hi_d']; }

	$questions_set->hi_ans_key 		= $_POST['hi_ans_key']; 


	$questions_set->status					= 1;
	$questions_set->date_					= date("Y-m-d");
	$questions_set->time_					= date("H:i:s");
	

	if($questions_set->save()) {
		$session->message("Qeustion Saved Succefully");
		redirect_to("index.php?1");
	} else {
		$session->message("Failed to Raise Complaint");
		redirect_to("index.php?2");
	}


?>