<?php

//require_once("db_conn_class.php");

require_once("webform_class.php");

//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['contact']) && ($_POST['contact'] != ""))

{

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

}

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

{

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

}

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

{

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

}

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

{

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

}

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

{

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

}

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['comment']) && ($_POST['comment'] != ""))

{

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

}

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

//when save button is clicked

if(isset($_POST['txtAction']) && ($_POST['txtAction'] == "save_data"))

{	

    		

    //saving data into database

	$app->InsertData();	

	

	//for sending mail

	$app->SendMail();

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

	//echo $id;

	//return;

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

}

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

//index form

if(isset($_POST['txtAction4']) && ($_POST['txtAction4'] == "save_data"))

{	

    		

    //saving data into database

	$app->InsertData4();	

	

	//for sending mail

	$app->SendMail4();

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

	//echo $id;

	//return;

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

}

if(isset($_POST['txtAction_sf']) && ($_POST['txtAction_sf'] == "save_data"))

{	

  

    //saving data into database

	$app->InsertData_sf();	

	

	//for sending mail

	$app->SendMail_sf();

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

	//echo $id;

	//return;

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

}

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

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

{	

    		

    //saving data into database

	$app->InsertData_rightpanel();	

	

	//for sending mail

	$app->SendMail_rightpanel();

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

	//echo $id;

	//return;

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

}

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

$flag= 0;

//for Subscribe to our Newsletter! (ACT)

if(isset($_POST['txtAction1']) && ($_POST['txtAction1'] == "save_data"))

{	

    		

    //saving data into database

	$app->InsertData1();	

	

	//for sending mail

	$app->SendMail1();

	$app->SendMailToCandidate();

	

	$flag = 1;

	$msg ="Thank you for registering for the ACT's newsletter.";

	

	/*echo "<script type='text/javascript'>

        window.open('https://www.asiancollegeofteachers.com/newsletter-images/newsletter.html', '_blank')

    </script>";*/

	@header("Location:thankyou-join-newsletter.php");

	

}

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



?>