<?php

session_start();

ob_start();

include_once("../dbconnect.php");

$action = isset($_GET['action']) ? $_GET['action'] : '';

 switch ($action) {


    case 'add' :

        add();

        break;

    case 'delete' :

        delete();

        break;	

		

	    case 'edit' :

	     edit();

         break;

		    case 'status' :

	     status();

         break;

		 

default :

        // if action is not defined or unknown

        // move to main category page

        header('Location: welcomepage.php');

		

}

function add()

{
 
	mysql_query("insert into countries(country_name,status) values('".$_POST['country_name']."',1)");

header("location:addcontry.php");

}

function delete()

{

	mysql_query("delete from countries where country_id=".$_GET['cntid']);

	header("location:addcontry.php");

}

 

function status()

{

	mysql_query("update mec_gallery set mec_status='".$_GET['mec_status']."' where mec_p_id=".$_GET['mec_p_id']);

	header("location:addcontry.php");

}

?>