PHP

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

<?

php

session_start();

// print_r($_REQUEST['data']);

$data=$_REQUEST['data'];

$name=$_REQUEST['name'];

$email=$_REQUEST['email'];

$contact=$_REQUEST['contact'];

$present_address=$_REQUEST['present_address'];

$permanent_address=$_REQUEST['permanent_address'];

$domicile=$_REQUEST['domicile'];

$cnic=$_REQUEST['cnic'];

$age=$_REQUEST['age'];

$marital_status=$_REQUEST['marital_status'];

$working_status=$_REQUEST['working_status'];

$app_company_name=$_REQUEST['app_company_name'];

$app_designation=$_REQUEST['app_designation'];

$net_income=$_REQUEST['net_income'];

$gender=$_REQUEST['gender'];

// father details

$father_name=$_REQUEST['father_name'];

$father_livingStatus=$_REQUEST['father_livingStatus'];

$father_cnic=$_REQUEST['father_cnic'];

$professional_status=$_REQUEST['professional_status'];

$father_phone=$_REQUEST['father_phone'];
$company_name=$_REQUEST['company_name'];

$ntn=$_REQUEST['ntn'];

$father_occupation=$_REQUEST['father_occupation'];

$father_designation=$_REQUEST['father_designation'];

$father_grossIncome=$_REQUEST['father_grossIncome'];

$father_netIncome=$_REQUEST['father_netIncome'];

$guardian_name=$_REQUEST['guardian_name'];

$guardian_relation=$_REQUEST['guardian_relation'];

$guardian_occupation=$_REQUEST['guardian_occupation'];

$guardian_designation=$_REQUEST['guardian_designation'];

$guardian_monthlySupport=$_REQUEST['guardian_monthlySupport'];

//education

$edr_study_level=$_REQUEST['edr_study_level'];

$edr_institute_name=$_REQUEST['edr_institute_name'];

$edr_fee=$_REQUEST['edr_fee'];

$edr_duration=$_REQUEST['edr_duration'];

$edr_division=$_REQUEST['edr_division'];

$edr_percentage=$_REQUEST['edr_percentage'];

$edr_previousFee=$_REQUEST['edr_previousFee'];

$edr_previousScholarship=$_REQUEST['edr_previousScholarship'];

$edr_scholarship=$_REQUEST['edr_scholarship'];

$edr_scholarshipName=$_REQUEST['edr_scholarshipName'];

$edr_scholarshipAmount=$_REQUEST['edr_scholarshipAmount'];

$edr_scholarshipPeriod=$_REQUEST['edr_scholarshipPeriod'];

$edr_scholarshipLevel=$_REQUEST['edr_scholarshipLevel'];

// accomodation
$accomodation_type=$_REQUEST['accomodation_type'];

$accomodation_status=$_REQUEST['accomodation_status'];

$accomodation_size=$_REQUEST['accomodation_size'];

$rooms= $_REQUEST['rooms'];

$airconditioners= $_REQUEST['airconditioners'];

//loan

$loan_amount= $_REQUEST['loan_amount'];

$loan_interest= $_REQUEST['loan_interest'];

$loan_relation=$_REQUEST['loan_relation'];

//bills

$telephone_bill=$_REQUEST['telephone_bill'];

$telephone_electricity=$_REQUEST['telephone_electricity'];

$gas_bill=$_REQUEST['gas_bill'];

$water_bill= $_REQUEST['water_bill'];

$medical_bill= $_REQUEST['medical_bill'];

addUser($name,$email,$contact,$present_address,$permanent_address,$domicile,$cnic,$age,$marital
_status,$working_status,$app_company_name,$app_designation,$net_income,$gender);

addGuard($father_name,$father_livingStatus,$father_cnic,$professional_status,$father_phone,$compa
ny_name,$ntn,$father_occupation,$father_designation,$father_grossIncome,$father_netIncome,$guar
dian_name,$guardian_relation,$guardian_occupation,$guardian_designation,$guardian_monthlySuppo
rt);
addAccomodation($accomodation_type,$accomodation_status,$accomodation_size,$rooms,$airconditi
oners);

addExpense($telephone_bill,$telephone_electricity,$gas_bill,$water_bill,$medical_bill);

addLoan($loan_amount,$loan_interest,$load_relation);

/* FAMILY DETAILS*/

foreach($_REQUEST[family] as $family)

$Famname= $family['Famname'];

$famrelation= $family['famrelation'];

$Marital_status=$family['Marital_status'];

$FMO=$family['FMO'];

$OGN=$family['OGN'];

$fa_designation=$family['fa_designation'];

$MonthlyEarning=$family['MonthlyEarning'];

$Study_status=$family['Study_status'];

$NOI=$family['NOI'];

$FPM=$family['FPM'];

addFamily($Famname,$famrelation,$Marital_status,$FMO,$OGN,$fa_designation,$MonthlyEarning,$St
udy_status,$NOI,$FPM);
}

/* Asset */

foreach($_REQUEST[asset] as $asset)

$asset_name= $asset['asset_name'];

$asset_Relationship= $asset['asset_Relationship'];

$asset_income=$asset['asset_income'];

addAsset($asset_name,$asset_Relationship,$asset_income);

/* Asset worth*/

foreach($_REQUEST[aworth] as $worth)

$assestWorth_title= $worth['assestWorth_title'];

$afam_relation= $worth['afam_relation'];

$assestWorth_amount=$worth['assestWorth_amount'];

addWorth($assestWorth_title,$afam_relation,$assestWorth_amount);

/* Family Income */
foreach($_REQUEST[fincome] as $income)

$famMembername=$income['famMember_name'];

$famrelation=$income['fam_relation'];

$monthlyincome=$income['monthlyAsset_income'];

$monthlyincome= $income['monthlyTakeHOme_income'];

addFamilyIncome($famMembername,$famrelation,$monthlyAincome,$monthlyincome);

function addUser($n,$e,$contact,$pa,$pr,$do,$cn,$age,$ms,$ws,$acn,$ad,$ni,$g){

require_once "DB_connection\connection.php";

$sql="INSERT INTO applicant


(App_Name,App_Gender,App_CNIC,App_MaritalStatus,App_Age,App_Domicile,App_AddressCurrent,Ap
p_AddressPermanent,App_WorkStatus,App_Designation,App_NameofComp,App_NetIncome,App_PhN
o,App_Email) VALUES('$n','$g','$cn','$ms','$age','$do','$pa','$pr','$ws','$ad','$acn','$ni','$contact','$e')";

$res=mysql_query($sql);

$res;
if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';

function
addFamily($fa_name,$fa_rel,$fa_ms,$fa_mo,$fa_ogn,$fa_desg,$fa_me,$fa_ss,$fa_noi,$fa_fpm){

$sql="INSERT INTO family_details


(Fam_MemberName,Fam_Relation,Fam_MaritalStatus,Fam_Occupation,Fam_Designation,Fam_CompN
ame,Fam_MonthGrossEarning,Fam_StudyStatus,Fam_NameOfInstitute,Fam_PerMonthFee)
VALUES('$fa_name','$fa_rel','$fa_ms','$fa_mo','$fa_desg','$fa_ogn','$fa_me','$fa_ss','$fa_noi','$fa_fpm'
)";

$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';

}
/* Guardian Details */

function addGuard($fna,$fls,$fcnic,$ps,$fp,$cna,$ntn,$foc,$fdg,$fgi,$fni,$gn,$grl,$goc,$gds,$gms){

require_once "DB_connection\connection.php";

$sql="INSERT INTO guardian


(Guar_FatherName,Guar_FatherCNIC,Guar_Living_Status,Guar_ProfStatus,Guar_EmployerName,Guar_P
hNo,Guar_FathOccup,Guar_FathDesig,Guar_IncomeGross,Guar_IncomeNet,Guar_Name,Guar_Relation,
Guar_Occup,Guar_Desig,Guar_MonthlySupport,Guar_NTN)
VALUES('$fna','$fcnic','$fls','$ps','$cna','$fp','$foc','$fdg','$fgi','$fni','$gn','$grl','$goc','$gds','$gms','$ntn')
";

$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';

/* ASSET DETAILS*/

function addAsset($an,$ar,$ai){

require_once "DB_connection\connection.php";

$sql="INSERT INTO assets_income(AI_Title,AI_Owner,AI_Income) VALUES('$an','$ar','$ai')";


$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';

/* Family Income DETAILS*/

function addFamilyIncome($fin,$fir,$fim,$finm){

require_once "DB_connection\connection.php";

$sql="INSERT INTO family_income(FI_Name,FI_Relation,FI_AssetsMonthly,FI_NetMonthly)


VALUES('$fin','$fir','$fim','$finm')";

$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';
}

/* ASSET WORTH DETAILS*/

function addWorth($aw,$awr,$awa){

require_once "DB_connection\connection.php";

$sql="INSERT INTO total_assets(TA_Title,TA_Relation,TA_Worth) VALUES('$aw','$awr','$awa')";

$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';

addEdu($edr_study_level,$edr_institute_name,$edr_fee,$edr_duration,$edr_division,$edr_percentage,
$edr_previousFee,$edr_previousScholarship,$edr_scholarship,$edr_scholarshipName,$edr_scholarship
Amount,$edr_scholarshipPeriod,$edr_scholarshipLevel);

$_SESSION['USERDATA']['LOGIN_FLAG']=true;
$_SESSION['USERDATA']['USERNAME']=$row['txtFirstName'];

$_SESSION['USERDATA']['USERID']=$row['txtCnic'];

$_SESSION['NAVIGATION_MSG']=$msg;

unset($_SESSION['USERDATA']);

echo '<script language="JavaScript">';

echo 'alert("Your Form Has been Submitted \n Click OK to exit")';

echo '</script>';

echo '<script language="JavaScript">';

echo ' window.location="index.php"';

echo '</script>';

function
addEdu($el,$ename,$efee,$eduration,$edivision,$epercent,$eprevFee,$eprevSchol,$escholarship,$esch
olName,$escholAmount,$escholPeriod,$escholevel){

require_once "DB_connection\connection.php";

$sql="INSERT INTO education_record


(Edr_LOS,Edr_NameOfInstitute,Edr_PerMonthFeeCurrent,Edr_Duration,Edr_Division,Edr_PerMonthFee
Prev,Edr_RecentScholarship,Edr_SchName,Edr_SchInstitute,Edr_SchAmount,Edr_SchPeriod,Edr_SchLev
el,Edr_Percentage)
VALUES('$el','$ename','$efee','$eduration','$edivision','$eprevFee','$eprevSchol','$escholName','$escho
larship','$escholAmount','$escholPeriod','$escholevel','$epercent')";

$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';
}

function addAccomodation($at,$ast,$asz,$rooms,$airc){

require_once "DB_connection\connection.php";

$sql="INSERT INTO accomodation_exp(Acc_Type,Acc_Status,Acc_Size,Acc_Rooms,Acc_AC)


VALUES('$at','$ast','$asz','$rooms','$airc')";

$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';

function addExpense($telb,$elecb,$gb,$wb,$mb){

require_once "DB_connection\connection.php";

$sql="INSERT INTO utilities_exp(Ut_Telelphone,Ut_Electricity,Ut_Gas,Ut_Water,Ut_Medical)


VALUES('$telb','$elecb','$gb','$wb','$mb')";
$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';

function addLoan($lamount,$linterest,$lrelation){

require_once "DB_connection\connection.php";

$sql="INSERT INTO loan_exp(L_Amount,L_InterestCharged,L_Relation)


VALUES('$lamount','$linterest','$lrelation')";

$res=mysql_query($sql);

$res;

if($res===FALSE)

echo '<br/><p style="color:white"> Error: Unable to insert data.</p>'. mysql_error();

else

echo '<br/><p style="color:white">Success: "'.mysql_affected_rows ().'" record(s)


inserted.</p>';

?>

You might also like