<?php
session_start();
	
include_once("../class/class.MySQL.php");
require '../class/resizeImage.php';
$db=new MySQL();


$action	= $_GET['action'];
if ($action == 'update') {
	
	$data=array();
	$sel_id = $_GET['sel_id'];
	
	$data['sel_name_cand'] = $_POST['sel_name'];
	$data['sel_dept'] = $_POST['department'];
	$data['sel_desg'] = $_POST['recdesg'];
	$data['sel_gender'] = $_POST['sel_gender'];
	$data['sel_loc'] = $_POST['sel_loc'];
	/*$data['sel_sal'] = $_POST['sel_salary'];
	$data['sel_doj'] = date('Y-m-d',strtotime($_POST['sel_doj']));
	$data['sel_prb_prd']	= $_POST['sel_prb_prd'];*/
	$data['sel_phone']	= $_POST['sel_phone'];
	$data['sel_email']	= $_POST['sel_email'];
	$selectedadd	=	$db->Update('selected_list',$data,array('sel_id'=>$sel_id));
	
	//upload image and resume and enter it to file
	
	
	/*
	
	$data2['rect_resumeup']=$_FILES["resume"]["name"];
	
	$allowedExts = array("doc", "docx", "pdf" ,"zip","rar");
	$temp = explode(".", $_FILES["resume"]["name"]);
	$extension = end($temp);
	if (in_array($extension, $allowedExts))
	  {
	  if ($_FILES["resume"]["error"] > 0)
		{
		echo "Return Code: " . $_FILES["resume"]["error"] . "<br>";
		}
	  else
		{
	   "Upload: " . $_FILES["resume"]["name"] . "<br>";
		"Type: " . $_FILES["resume"]["type"] . "<br>";
		"Size: " . ($_FILES["resume"]["size"] / 1024) . " kB<br>";
		"Temp file: " . $_FILES["resume"]["tmp_name"] . "<br>";
	
		if(file_exists("../upload/resume/". $_FILES['resume']['name']))
		  {
		  echo "<script>alert('filename already exists.')</script> ";
		  }
		else
		  {
		  move_uploaded_file($_FILES["resume"]["tmp_name"],
		  "../upload/resume/". $_FILES["resume"]["name"]);
		   echo "<script>alert('Your Resume has Been Submitted!!')</script> ";
		  }
		}
	  }
	
	$where['rect_id']			= $employee1;
	$db->Update('recruitment',$data2,$where);*/
}
if ($action == 'get') {
	$sel_id = $_GET['sel_id'];
	$select_list  = $db->fetchQuery('select * from selected_list where sel_id="'.$sel_id.'"');
	echo '{"select_list":'.json_encode($select_list).'}';
}	
	
	?>