I can't figure out why the form can't submit data to the MySQL database. I don't even get any errors, that would help me understand the problem. I tried to change the action method to GET, to see if the form accepts the data, and it does, the information gets displayed in the URL, but it doesn't insert anything in the database. Thanks.
This is the insert function (located in info_file.php):
function insert_records($employee_id_fk,$license_num, $expiry_date,
$aquired_date, $penalty_point)
{
global $connection_Var;
mysqli_query($connection_Var,
"INSERT INTO bus_driver
(`employee_id_fk`,`license_num`,`expiry_date`,
`aquired_date`,`penalty_point`)
VALUES ('".$employee_id_fk."', '".$license_num."','".
$expiry_date."','".$aquired_date."','".$penalty_point."')");
}
This is the code that will be executed by the form (lcoated in new_instance.php):
<?php
include 'info_file.php';
Open_Connection();
insert_records($_POST["employee_id_fk"],$_POST["license_num"],
$_POST["expiry_date"],$_POST["aquired_date"],
$_POST["penalty_point"]);
header( 'Location:view.php');
Close_Connection();
?>
This is the form:
<form action="new_instance.php" method="post">
<p>Employee ID: <input type="text" name="employee_id_fk"></p>
<p>License Number: <input type="text" name="license_num"></p>
<p>Expiry date: <input type="text" name="expiry_date"></p>
<p>Aquired data: <input type="text" name="aquired_date"></p>
<p>Penalty point: <input type="text" name="penalty_point"></p>
<input type="submit" value="Submit" />
</form>
First time using stack overflow, so if sorry if there are mistakes in the formatting. Also, I don't if there is a way to attach the files (I guess there isn't for security purposes), as it is a project with multiple files, I had to take only the code that I think is the issue.