I have two tables named interview and personal_info. I'm having a problem inserting values into my database. I need to insert the values of txtTest, txtIntervieweddBy, txtRemarksDate, txtComment and txtRemarks to interview table. There's also this txtRemarksStatus in the same form but its use is to update a row in a different table named personal_info.
<?php
include_once 'php/connection.php';
$connect = mysqli_connect("localhost", "root", "", "trackingsystemdb");
$number = count($_POST["txtIntervieweddBy"]);
if($number > 0)
{
for($i=0; $i<$number; $i++)
{
if(trim($_POST["txtIntervieweddBy"][$i] != ''))
{
$sql = "INSERT INTO interview (applicant_code, interviewed, dateInterviewed, comment, remarks) VALUES('".mysqli_real_escape_string($connect, $_POST["txtTest"][$i])."','".mysqli_real_escape_string($connect, $_POST["txtIntervieweddBy"][$i])."','".mysqli_real_escape_string($connect, $_POST["txtRemarksDate"][$i])."','".mysqli_real_escape_string($connect, $_POST["txtComment"][$i])."','".mysqli_real_escape_string($connect, $_POST["txtRemarks"][$i])."')";
}
}
}
$id = $_GET['id'];
$txtRemarksStatus=$_GET['txtRemarksStatus'];
$sql = "UPDATE personal_info SET status = '$txtRemarksStatus'
WHERE applicant_code = '$id'";
if (mysqli_multi_query($connect, $sql)) {
} else {
echo "Error ".mysqli_error($connect);
}
header('Location: addinterview.php?insert=sucess');
exit();
?>