<?php

	session_start();

	

	//Included Files

	include("dbConnection.php");

	include("admin.php");

	

	//Retrieving Form Fields

	$category = $_REQUEST["selCategory1"];

	$name = $_REQUEST["texName1"];

	$userName = $_REQUEST["texUserName1"];

	$password = $_REQUEST["pasPassword1"];

		

	/* 

	echo $category . "<br/>";

	echo $name . "<br/>";

	echo $userName . "<br/>";

	echo $password . "<br/>";

	 */

	

	//Creating 'dbConnection' Object

	$dbObject = new dbConnection();

	$con = $dbObject->getConnection();

	//echo $con;

	

	if($con)

	{

		//MySQL Connection Established

		$dbResult = $dbObject->selectDatabase();

		if($dbResult)

		{

			$adminObj = new admin();

			$insertResult = $adminObj->insertNewUser($category,$name,$userName,$password,$con);

			if($insertResult)

			{

				header('Location:AddUser.php?success=User%20Added%20Successfully');

			}

			else

			{

				header('Location:AddUser.php?failure=Unable%20To%20Insert');

			}

		}			

	}

	else

	{

		echo mysql_errno() . "<br/>" . mysql_error();

	}

?>