I have a database with a table called memberloaninfo with 6 columns which are log/loanprocess/interviewtime/inspectiontime/approvaltime/disbursaltime.
I want to insert timestamps into timefields once user makes loan process selection from a drop down selection box. So if user for ex. selects inspection as loan process it would process the query that updates inspectiontime with timestamp and loanprogress column with the value inspection and visa versa for other selection values. Problem is that the code isnāt working at all. How can i fix this? Any and all help will be appreciated.
My html and php codeās are:
if(isset($_POST['update'])){
$log = $_POST['log'];
$loanprogress = $_POST['loanprogress'];
$interviewtime = date('y-m-d H:i:s');
$inspectiontime = date('y-m-d H:i:s');
$approvaltime = date('y-m-d H:i:s');
$disbursaltime = date('y-m-d H:i:s');
if ($loanprogress == '$inspection'){
//mysqli_query($connection," INSERT INTO memberloaninfo interviewtime VALUE $interviewtime WHERE interviewtime is NULL");
mysqli_query($connection," UPDATE memberloaninfo SET loanprogress = '$inspection', inspectiontime = '$inspectiontime' WHERE log = '$log'");
}
else if($loanprogress == '$approval'){
//mysqli_query($connection," INSERT INTO memberloaninfo interviewtime VALUE $interviewtime WHERE interviewtime is NULL");
mysqli_query($connection," UPDATE memberloaninfo SET loanprogress = '$approval', approvaltime = '$approvaltime' WHERE log = '$log'");
}
else if ($loanprogress == '$disbursal'){
//mysqli_query($connection," INSERT INTO memberloaninfo interviewtime VALUE $interviewtime WHERE interviewtime is NULL");
mysqli_query($connection," UPDATE memberloaninfo SET loanprogress = '$disbursal', disbursaltime = '$disbursaltime' WHERE log = '$log'");
}
}
?>
<form method = "post" action = "">
<table width = "400" border =" 0" cellspacing = "1"
cellpadding = "2">
<tr>
<td width = "100">Enter Log Number</td>
<td><input name = "log" type = "text"
id = "log"></td>
</tr>
<tr>
<td width = "100">Select Loan Progress</td>
<td><p>
<select >
<option value="">Select...</option>
<option value="inspection">inspection</option>
<option value="approval">approval</option>
<option value="disbursal">disbursal</option>
</select>
</p></td>
<tr>
<td width = "100"> </td>
<td>
<input type = "submit" value = "Submit">
</td>
</tr>
</table>
</form>