У меня есть этот код:
<?php
include 'dbConfig.php';
$statusMsg = '';
if (isset($_POST['submit'])) {
// FILE 1
$file = $_FILES['file'];
$fileName = $_FILES['file']['name'];
$fileTmpName = $_FILES['file']['tmp_name'];
$fileError = $_FILES['file']['error'];
$fileSize = $_FILES['file']['size'];
$fileType = $_FILES['file']['type'];
$name = mysqli_real_escape_string($db, $_POST['name']);
$code = mysqli_real_escape_string($db, $_POST['code']);
$fileExt = explode('.', $fileName);
$fileActualExt = strtolower(end($fileExt));
$allowed = array('jpg', 'jpeg', 'png');
if (in_array($fileActualExt, $allowed)) {
$fileNameNew = uniqid('',true).".".$fileActualExt;
$fileDestination = 'uploads/'.$fileNameNew;
move_uploaded_file($fileTmpName, $fileDestination);
$insert = $db->query("INSERT into parfumruya (file_name, uploaded_on, name, code) VALUES ('".$fileNameNew."', NOW(), '$name', '$code')");
if ($insert) {
header("Location: succes.html");
} else{
header("Location: bazadedate.html");
}
} else{
header("Location: filetype.html");
}
} else{
echo '<script>history.pushState({}, "", "")</script>';
header("Location: https://google.com");
}
?>
Этот код добавляет мне некоторую информацию в базе данных из HTML формы, как показано: file_name, uploaded on, name, code
Как добавить несколько изображений в тот же столбец? На данный момент в одном столбце у меня есть только одна строка изображения, которая file_name
Я хочу в одном столбце 5 строк изображений, таких как: file_name, file_name2, file_name3, file_name4, file_name5
Мой html код такой:
<input class="input1" type="text" name="name" placeholder="Nume" required>
<input class="input1" type="text" name="code" placeholder="Nr Consultant" required>
<input type="checkbox" id="read" name="read" value="read" required>
1. <input type="file" name="file" required><br><br>
2. <input type="file" name="filea" required><br><br>
3. <input type="file" name="fileb" required><br><br>
4. <input type="file" name="filec" required><br><br>
5. <input type="file" name="filed" required><br><br>
<span class="shadow-input1"></span>