<?php
session_start();
 header("Content-type: text/html; charset=windows-1256");
if($_SESSION['dbName']==""){
header("location:../index.php");
}
include("config.inc.php");
include("Functions_UserAccess.php");
include("function.inc.php");


$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'],$connection) or die("Could not find DB");
$actionmode = $_POST["actionmode"]; if ($actionmode == ""){$actionmode = $_GET["actionmode"];}
$txtRetailPointId = $_POST["txtRetailPointId"]; if ($txtRetailPointId == ""){$txtRetailPointId = $_GET["txtRetailPointId"];}

if($actionmode == 'submitRetail'){
	$query_retail = "insert into retailpoint(amount, retail_point) values
				($txtFromAmount, $txtPointRewarded)";
	$res_retail = mysql_query($query_retail, $connection); 
	
}
if($actionmode == 'editRetailPoint'){
	$query_retail = "update retailpoint set amount = $txtFromAmount, retail_point = $txtPointRewarded
				where retailpoint_id = $txtRetailPointId"; 
	$res_retail = mysql_query($query_retail, $connection);
}
if($actionmode == 'deleteRetailPoint'){
	$query_retail = "delete from retailpoint where retailpoint_id = $txtRetailPointId"; 
	$res_retail = mysql_query($query_retail, $connection);
}

header("Location: ./Form_retailSetup.php");

?>