<?php 
require_once("webform_class.php");
@session_start();

//creating object of res info class

$app = new app();

/*$dbh = new db_conn();

$dbh->set_conn();*/

//==========================================================================

//retaining the value of the variables

if(isset($_POST['txtname']) && ($_POST['txtname'] != ""))

{

	$app->name =  str_replace("'"," ",$_POST['txtname']);

}

if(isset($_POST['phone']) && ($_POST['phone'] != ""))

{

	$app->contact =  str_replace("'"," ",$_POST['phone']);

}

if(isset($_POST['txturl']) && ($_POST['txturl'] != ""))
{
	$app->txturl = $_POST['txturl'];
}
if(isset($_POST['txtemail']) && ($_POST['txtemail'] != ""))

{

	$app->email =  str_replace("'"," ",$_POST['txtemail']);

}

if(isset($_POST['program']) && ($_POST['program'] != ""))

{

	$app->course =  str_replace("'"," ",$_POST['program']);

}

if(isset($_POST['country']) && ($_POST['country'] != ""))

{

	$app->country =  str_replace("'"," ",$_POST['country']);

}

if(isset($_POST['location']) && ($_POST['location'] != ""))

{

	$app->location =  str_replace("'"," ",$_POST['location']);

}

if(isset($_POST['city']) && ($_POST['city'] != ""))

{

	$app->city =  str_replace("'"," ",$_POST['city']);

}

if(isset($_POST['qualification']) && ($_POST['qualification'] != ""))

{

	$app->qualification =  str_replace("'"," ",$_POST['qualification']);

}

if(isset($_POST['workexperience']) && ($_POST['workexperience'] != ""))

{

	$app->workexperience =  str_replace("'"," ",$_POST['workexperience']);

}


if(isset($_POST['message']) && ($_POST['message'] != ""))

{

	$app->comment =  str_replace("'"," ",$_POST['message']);

}

//==========================================================================

//when save button is clicked

if(isset($_POST['apply_submit']) && ($_POST['apply_submit'] == "Submit"))

{	

 /*if($_SESSION['tb_captcha_key']!=$_POST['tb_captcha'])  
//check whether stored in session value with the user submitted values
{
	$_SESSION['CAPTCHA_ERROR'] = "Invalid Captcha Code.";
	@header("Location:apply.php#msg");
	
}else{ 	*/

    //saving data into database

	$app->InsertData_apply();	

	

	//for sending mail

	$app->SendMail_apply();

	//$id = $_GET['id'];

	//echo $id;

	//return;

	@header("Location:thankyou.php");
//}

}

//========================== COURSES COMMON FORM START ================================================

if(isset($_POST['common_course_submit']) && ($_POST['common_course_submit'] == "save_data_common"))
{	
    
    //saving data into database
	$app->InsertData_common_course();	
	
	//for sending mail
	$app->SendMail_common_course();
	//$id = $_GET['id'];
	//echo $id;
	//return;
	@header("Location:thankyou.php");
}
//============================== COURSES COMMON FORM END ============================================




?>