$lnb = "10"; $error_msg = ''; $flag = 0; if ($_POST['isSubmit'] == 'save') { //Edit the user info $fldSchoolname = $func->input_fun($_POST['fldSchoolname']); $whereClause = "fldSchoolname='" . $fldSchoolname . "'"; if ($db->MatchingRec(TBL_HS_AAU_TEAM, $whereClause) > 0) { #user Username already exists $error_msg = 'This HS/AAU Team Code Already Exists!'; $flag++; } if ($flag == 0) { $errors = 0; //Insert data $Zipcode_lat_lon = $func->getLatLong($func->input_fun($_POST['fldZipcode']), MAPS_APIKEY); $strDataArr = array('fldSchoolname' => $func->input_fun($_POST['fldSchoolname']), 'fldAddress' => $func->input_fun($_POST['fldAddress']), 'fldCity' => $func->input_fun($_POST['fldCity']), 'fldState' => $func->input_fun($_POST['fldState']), 'fldZipcode' => $func->input_fun($_POST['fldZipcode']), 'fldStatus' => $func->input_fun($_POST['fldStatus']), 'fldEnrollment' => $func->input_fun($_POST['fldEnrollment']), 'fldLatitude' => $Zipcode_lat_lon['Latitude'], 'fldLongitude' => $Zipcode_lat_lon['Longitude']); //$s=$_POST; //print_r($s); $db->insertRec(TBL_HS_AAU_TEAM, $strDataArr); #redirect to listing page on successfull updation header("Location: ADSchoolList.php?msg={$fldSchoolname} is Added Successfully, "); } //this section is use to filup the value after erro message. if ($error_msg != "") { $fldSchoolname = $_REQUEST['fldSchoolname']; $fldAddress = $_REQUEST['fldAddress']; $fldCity = $_REQUEST['fldCity']; $fldState = $_REQUEST['fldState']; $fldZipcode = $_REQUEST['fldZipcode']; $fldEnrollment = $_REQUEST['fldEnrollment'];
if ($_REQUEST['fldJerseyNumber'] == '') { $error_msg[] = "Please Select Jersey Number."; } $mysqlDateString = date('Y-m-d H:i:s', $phpdate); $strDataArr = array('fldUsername' => $func->input_fun($_POST['fldUsername']), 'fldPassword' => $func->input_fun($_POST['fldPassword']), 'fldEmail' => $func->input_fun($_POST['fldEmail']), 'fldFirstname' => $func->input_fun($_POST['fldFirstname']), 'fldLastname' => $func->input_fun($_POST['fldLastname']), 'fldClass' => $func->input_fun($_POST['fldClass']), 'fldHeight' => $func->input_fun($_POST['fldHeight']), 'fldWeight' => $func->input_fun($_POST['fldWeight']), 'fldSchool' => $Team_id, 'fldSport' => $sport_empty, 'fldStatus' => $func->input_fun($_POST['fldStatus']), 'fldIntendedMajor' => $func->input_fun($_POST['fldIntendedMajor']), 'fldOthers' => $func->input_fun($_POST['fldOthers']), 'fldQuestion' => $func->input_fun($_POST['fldQuestion']), 'fldAnswer' => $func->input_fun($_POST['fldAnswer']), 'fldState' => $func->input_fun($_POST['fldState']), 'fldJerseyNumber' => $func->input_fun($_POST['fldJerseyNumber']), 'fldAddDate' => date("y-m-d")); //Continue If No Form Errors if (count($error_msg) == 0) { //Insert Data - Get NewUserID $res = $db->insertRec(TBL_ATHELETE_REGISTER, $strDataArr); $NewUserId = $res; if ($_POST['fldSchool'] == "other") { ########################################## ### Insert Custom College ### ########################################## //Get Lattitude & Longitude $Zipcode_lat_lon = $func->getLatLong($_POST['fldZipcode'], MAPS_APIKEY); //Build Insert Data $fldStatus = "ACTIVE"; $strDataArr_school = array('fldSchoolname' => $func->input_fun($_POST['txtfldName']), 'fldAddress' => $func->input_fun($_POST['fldAddress']), 'fldCity' => $func->input_fun($_POST['fldCity']), 'fldState' => $func->input_fun($_POST['fldState']), 'fldZipcode' => $func->input_fun($_POST['fldZipcode']), 'fldStatus' => $fldStatus, 'fldLatitude' => $Zipcode_lat_lon['Latitude'], 'fldLongitude' => $Zipcode_lat_lon['Longitude'], 'fldAdminApproved' => 0, 'fldAddByAthleteUsername' => $_POST['fldUsername'], 'fldAddDate' => date("y-m-d")); //Insert & Set CollegeSchoolId $NewSchoolId = $db->insertRec(TBL_HS_AAU_TEAM, $strDataArr_school); $HighSchoolId = $NewSchoolId; //Update User's fldSchool column $strDataArr_schoolreg_update = array('fldSchool' => $HighSchoolId); $where_schoolreg_update = "fldId = " . $NewUserId; $db->updateRec(TBL_ATHELETE_REGISTER, $strDataArr_schoolreg_update, $where_schoolreg_update); ################# Insert Custom College ################# } // Send email to coach for Approval if ($_POST['fldSchool'] != "other") { //User Selected School