$cafe_mgmt = new CafeMgmt(); $cafe_details = new CafeDetails(); $sugar_soap = new SugarSoap(); //getting values from post $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $department = $_POST['department']; $role_id = $_POST['role']; $counttry = $_POST['country']; $state = $_POST['state']; $city = $_POST['city']; $reports_to_id = $_SESSION['user_id']; $name = $first_name . ' ' . $last_name; if ($session_id) { if ($cafedb_result = $cafe_details->insertEmp($name, $city)) { $id = $cafe_details->getMaxEmployeeId(); $user_id = generateUserId($city, $id); //calling function to enter values in sugar crm, using soap $sugar_result = $sugar_soap->insertEmployee($session_id, $user_id, $first_name, $last_name, $department, $country, $state, $city, $phone_mobile, $reports_to_id); } else { echo 'can not insert in database'; } } else { header("Location: ../account/login.php"); } //redirecting to the confirmation page if ($sugar_result) { $emp_id = $cafe_mgmt->getEmpId($user_id); $em_ass = $cafe_mgmt->assgnRole($emp_id, $role_id); $em_result = $cafe_mgmt->updateAssignEmUser($emp_id, $role_id, $city); if ($em_result && $em_ass) {