-
Added table field not populating
Hi ,
Morning.I have added some fields to the existing tables, but my php script doesnt populate to it.And the is no error showing for me to rectify.Those fields from the db table is incident_locality,cause_of_incident,incident_center and District_mun.Can someone assist ASAP.Thanks in advance
<?php
class LCASE extends MODULE
{
function Display()
{
if(!isset($_GET['save'])){
$this->Add_Template_File('case','html/cases.html');
$parts['status'] = ' ';
$parts['Creditor'] = ' ';
$parts['Debtor'] = ' ';
$parts['case_number'] = ' ';
$parts['Cause_of_Action'] = ' ';
$parts['Capital_Claimed'] = ' ';
$parts['Interest_Claimed'] = ' ';
$parts['Notice_Date'] = ' ';
$parts['Non_compliance'] = ' ';
return $this->Populate_Template_Parts('case',$parts);
}
else
return $this->Add_Case();
}
function GetLegalProcess(){
$lprocess = ltrim($_POST['legal_process']);
switch ($lprocess) {
case 1:
$process = 'Combined Summons';
break;
case 2:
$process = 'Notice of Application motion';
break;
}
return $process;
}
function GetProcessed(){
$lprocessed = ltrim($_POST['Cause_of_Action']);
switch ($lprocessed) {
case 1:
$lprocessed = 'Paja';
break;
case 2:
$lprocessed = 'Labour';
break;
case 3:
$lprocessed = 'Human Resource';
case 4:
$lprocessed = 'Bridge of contract';
case 5:
$lprocessed = 'Damage';
case 6:
$lprocessed = 'Defomation';
case 7:
$lprocessed = 'Discipline';
case 9:
$lprocessed = 'Medical Negligence';
case 10:
$lprocessed = 'Traditional Leaders Disputes';
}
return $lprocessed;
}
function GetDistrict(){
$lprocessed = ltrim($_POST['District_mun']);
switch ($lDistrict) {
case 1:
$lDistrict = 'Alfred Nzo';
break;
case 2:
$lDistrict = 'Amathole';
break;
case 3:
$lDistrict = 'Cacadu';
case 4:
$lDistrict = 'Chris hani';
case 5:
$lDistrict= 'Damage';
case 6:
$lDistrict = 'Nelson Mandela';
case 7:
$lDistrict = 'O R Tambo';
}
return $lDistrict;
}
function GetStatus(){
$input = ltrim($_POST['Status']);
switch ($input) {
case 1:
$status = 'Open';
break;
case 2:
$status = 'Appeal';
break;
case 3:
$status = 'Review';
break;
case 4:
$status = 'Closed';
}
return $status;
}
function Add_Case(){
$link = DB_Connect();
$query_id = 'SELECT MAX(case_id) AS id FROM tbl_cases` ';
$LastID = mysqli_query($link,$query_id);
$data = mysqli_fetch_array($LastID);
$NewId = $data['id'] +1;
$status = $this->GetStatus();
$lprocess = $this->GetLegalProcess();
$lprocessed = $this->GetProcessed();
$lDistrict = $this->GetDistrict();
$query = 'INSERT INTO tbl_cases set ';
$query .= ' case_id= "'.$NewId.'", ';
$query .= ' case_number = "'.ltrim($_POST['case_number']).'", ';
$query .= ' Creditor = "'.ltrim($_POST['Creditor']).'", ';
$query .= ' Debtor = "'.ltrim($_POST['Debtor']).'", ';
$query .= ' Letter_of_Demand = "'.ltrim($_POST['Letter_of_Demand']).'", ';
$query .= ' Cause_of_Action = "'.$lprocessed.'", ';
$query .= ' District_mun = "'.$lDistrict.'", ';
$query .= ' Capital_Claimed = "'.ltrim($_POST['Capital_Claimed']).'", ';
$query .= ' Interest_Claimed = "'.ltrim($_POST['Interest_Claimed']).'", ';
$query .= ' Legal_process = "'.$lprocess.'", ';
$query .= ' Court_Order = "'. basename( $_FILES['browse']['name']).'", ';
$query .= ' Summons = "'. basename( $_FILES['browsses']['name']).'", ';
$query .= ' Defense = "'. basename( $_FILES['browses']['name']).'", ';
$query .= ' Status = "'.$status .'", ';
$query .= ' Notice_Date = "'.$_POST['Notice_Date'].'", ';
$query .= ' received_date = "'.date('Y-m-d H:i:s').'", ';
$query .= ' Reason_NonCompliance = "'.$_POST['Non_compliance'].'"';
$result = mysqli_query($link,$query);
if (!$result )
$returnVal = error('Could not save case to database!').$query;
else
{
// Where the file is going to be placed
$target_pathC = "modules/cases/uploads/";
$target_pathS = "modules/cases/uploadis/";
$target_pathD = "modules/cases/uploading/";
/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_pathC = $target_pathC . basename( $_FILES['browse']['name']);
$target_pathS = $target_pathS . basename( $_FILES['browsses']['name']);
$target_pathD = $target_pathD . basename( $_FILES['browses']['name']);
if($_FILES['browse']['size'] > 0)
{
if(move_uploaded_file($_FILES['browse']['tmp_name'], $target_pathC))
{
echo "The file ". basename( $_FILES['browse']['name']).
" has been uploaded";
$returnVal = '<p align="center"></br></br><strong><font color="black" size="2">Case Details for </font><strong>
<font color="GREEN" size="2">"'.$_POST['Creditor'].'" </font></strong><font color="black" size="2"> registered successfully. Refrence Number is: '. $NewId .'. To view the case use this reference Number.</font> </p></br></br>';
}
else
{
$returnVal = "There was an error uploading the file, please try again!";
}
}
if($_FILES['browsses']['size'] > 0)
{
if(move_uploaded_file($_FILES['browsses']['tmp_name'], $target_pathS))
{
echo "The file ". basename( $_FILES['browsses']['name']).
" has been uploaded";
$returnVal = '<p align="center"></br></br><strong><font color="black" size="2">Case Details for </font><strong>
<font color="GREEN" size="2">"'.$_POST['Creditor'].'" </font></strong><font color="black" size="2"> registered successfully. Refrence Number is: '. $NewId .'. To view the case use this reference Number.</font> </p></br></br>';
}
else
{
$returnVal = "There was an error uploading the file, please try again!";
}
}
if($_FILES['browses']['size'] > 0)
{
if(move_uploaded_file($_FILES['browses']['tmp_name'], $target_pathD))
{
echo "The file ". basename( $_FILES['browses']['name']).
" has been uploaded";
$returnVal = '<p align="center"></br></br><strong><font color="black" size="2">Case Details for </font><strong>
<font color="GREEN" size="2">"'.$_POST['Creditor'].'" </font></strong><font color="black" size="2"> registered successfully. Refrence Number is: '. $NewId .'. To view the case use this reference Number.</font> </p></br></br>';
}
else
{
$returnVal = "There was an error uploading the file, please try again!";
}
}
}
return $returnVal;
}
}
?>
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks