CasperSecurity
<?php
session_start();
include '../../../../web/connection/connection.php';
//tds section variables
$tds_section_code = $_REQUEST['tds_section_code'];
$tds_natureof_payment = $_REQUEST['tds_natureof_payment'];
$ledger_head_id = $_REQUEST['ledger_head_id'];
$created_on = date("Y-m-d");
$created_by = $_SESSION['USER_ID'];
$is_active = 'yes';
//tds section rate variables
$tds_financial_year = $_REQUEST['tds_financial_year'];
$tds_individual_rate = $_REQUEST['tds_individual_rate'];
$tds_company_rate = $_REQUEST['tds_company_rate'];
$tds_nopan_rate = $_REQUEST['tds_nopan_rate'];
$tds_cutoff_amount = $_REQUEST['tds_cutoff_amount'];
//inserting data into tds section table
$db_handle = new DBController();
$newInsert = $db_handle->tableinsert("INSERT INTO tds_section(tds_section_code,tds_natureof_payment,ledger_head_id,created_on,created_by,is_active)
VALUES ('$tds_section_code','$tds_natureof_payment','$ledger_head_id','$created_on','$created_by','$is_active')");
if($newInsert == TRUE){
echo 'Data Inserted in table 1 Successfully';
//if insertion is successful in campus building table then fetch a particular primary key needed
$db_handle = new DBController();
$select = $db_handle->runQuery("SELECT tds_section_id FROM tds_section WHERE ledger_head_id = '$ledger_head_id' ");
foreach ($select as $v){
$tds_section_id = $v['tds_section_id']; // unique primary key needed as a data for the nested table
}
//inserting data into tds section rate table
$db_handle = new DBController();
$newInsert2 = $db_handle->tableinsert("INSERT INTO tds_section_rate(tds_section_id,tds_financial_year,tds_individual_rate,tds_company_rate,tds_nopan_rate,tds_cutoff_amount)
VALUES ('$tds_section_id','$tds_financial_year','$tds_individual_rate','$tds_company_rate','$tds_nopan_rate','$tds_cutoff_amount')");
if($newInsert2 == TRUE){
echo 'Data Inserted in table 2 Successfully';
}else{
echo 'Not Inserted 2' ;
}
}else{
echo 'Not Inserted 1' ;
}
?>