I think it should be like this:
Code: Select all
<?php
//import.php
if (isset($_POST["customerName"])) {
$connect = new PDO("mysql:host=localhost;dbname=nubuilder4", "root", "");
$customerName = $_POST["customerName"];
$customerPhone = $_POST["customerPhone"];
$customerEmail = $_POST["customerEmail"];
$customerAddress = $_POST["customerAddress"];
$appointmentDate = $_POST["appointmentDate"];
for ($count = 0;$count < count($customerName);$count++) {
$query .= "
INSERT INTO tbl_Customers(customerName, customerPhone, customerEmail, customerAddress, appointmentDate)
VALUES ('" . $customerName[$count] . "', '" . $customerPhone[$count] . "', '" . $ccustomerEmail[$count] . "', '" . $customerAddress[$count] . "', '" . $appointmentDate[$count] . "');
";
}
$statement = $connect->prepare($query);
$statement->execute();
}
?>