When i enter new values to form input field and submit them, then twice page reload needed to get the new values.
like you can see the $balance_2
in the 7th line. This line sum all row values of every row and and record the value in Balance
column of every row and after pressing submit button then it goes to update_2.php file to update the database and when in click on
<a style='left: -18%; top: 100%; position: absolute; color: white; font-family: Roboto, helvetica, arial, sans-serif; width: 170px; font-weight: 600;' href='index_2.php'>Click here to go back</a>
button in update_2.php file and go back to the main page then the form values are not updated till i reload it again.
I want that when i click on Click here to go back
button then new values should be shown and there must not be need to reload the page twice.
This is my codes
$id_2 = $row['ID'];
$Budget_2 = $row['Budget'];
$Availed_in_Regions_2 = $row['Availed_in_Regions'];
$Requested_in_KBL_2 = $row['Requested_in_KBL'];
$Received_in_KBL_2 = $row['Received_in_KBL'];
$Availed_in_KBL_2 = $row['Availed_in_KBL'];
$balance_2 = $Availed_in_Regions_2 + $Requested_in_KBL_2 + $Received_in_KBL_2 + $Availed_in_KBL_2;
$con2->query("UPDATE Office_Operations f1, (SELECT SUM(balance) AS bal FROM Office_Operations ) f2 SET ytotal6_2 = bal WHERE f1.id = 1;");
$con2->query("UPDATE Office_Operations SET Balance = $balance_2 WHERE id = $id_2");
echo "<div class='calc_container'"; if($row['ID']==1) echo " style='margin-bottom:40px;'"; echo ">
<input type='hidden' class='id_3' name='id[]' value='".$row['ID']."'>
<input type='text' class='budget_3' name='Budget[]' value='".$row['Budget']."'>
<input type='text' class='avail_region_3' name='Availed_in_Regions[]' value='".$row['Availed_in_Regions']."'>
<input type='text' class='req_kbl_3' name='Requested_in_KBL[]' value='".$row['Requested_in_KBL']."'>
<input type='text' class='rec_kbl_3' name='Received_in_KBL[]' value='".$row['Received_in_KBL']."'>
<input type='text' class='avail_kbl_3' name='Availed_in_KBL[]' value='".$row['Availed_in_KBL']."'>
<input type='text' class='balance_3' name='Balance[]' value='".$row['Balance']."'>
</div>";}