<!DOCTYPE html>
<html lang="de">
<head>
<title>Taru</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="./index.css" media="screen" />
</head>
<body>
<nav>
<input type="checkbox" class="hamburger" id="hamburger">
<label for="hamburger" class="hamburger">
<span class="line"></span>
<span class="line"></span>
<span class="line"></span>
</label>
<ul class="pop-up-menu">
<li><a class="active hover" href="index.php?page=home">Home</a></li>
<li><a class="hover" href="index.php?page=time">Zeit</a></li>
<li><a class="hover" href="index.php?page=test">Kontrolle</a></li>
<li><a class="hover" href="index.php?page=archiev">Archiev</a></li>
<li><a class="hover" href="index.php?page=delivery">Waren Ein/Ausgang</a></li>
</ul>
</nav>
<main><div class="content">
<form action="" method="post" enctype="multipart/form-data">
<label class="test-function">Kontroliert von:</label>
<select name="User" onchange="aktualisiere_progressbar()" class="test-function">
<option value="" disabled selected hidden>Auswählen</option>
<option>Andrin</option>
<option>Dario</option>
<option>David</option>
<option>Martin</option>
</select><br><br>
<label class="test-function">Gebaut von:</label>
<select name="Creator" class="test-function" onchange="aktualisiere_progressbar()">
<option value="" disabled selected hidden>Auswählen</option>
<option>Andrin</option>
<option>Dario</option>
<option>David</option>
<option>Martin</option>
</select><br><br>
<label class="test-function">Produkt:</label>
<select name="Object" class="test-function" onchange="aktualisiere_progressbar()">
<option value="" disabled selected hidden>Auswählen</option>
<option>94003</option>
<option>58052</option>
<option>51315</option>
<option>51317</option>
</select><br>
<label class="test-function">Serien Nummer</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="number" name="Serial-number-Text">
<br>
<label class="test-function">Sicht Prüfung</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="checkbox" name="visual-inspection">
<br>
<label class="test-function">Schrauben</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="checkbox" name="screw">
<br>
<label class="test-function">Kabel Verschraubungen</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="checkbox" name="cable-gland">
<br>
<label class="test-function">Zugkontroller</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="checkbox" name="plugs">
<br>
<label class="test-function">Durchgangsprüfung</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="checkbox" name="beep">
<br>
<label class="test-function">Säckli</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="checkbox" name="bag">
<br>
<label class="test-function">Serien Nummer</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="checkbox" name="Serial-Number">
<br>
<label class="test-function">Legende</label>
<input class="test-function" onchange="aktualisiere_progressbar()" type="checkbox" name="Type-label">
<br>
<label class="test-function">Innen</label><input class="test-function" onchange="aktualisiere_progressbar()" type="file" name="inside-Img" accept="image/*" capture/>
<br>
<label class="test-function">Deckel Geöffnet</label><input class="test-function" onchange="aktualisiere_progressbar()" type="file" name="top-Img" accept="image/*" capture/>
<br>
<label class="test-function">Stecker + Legende</label><input class="test-function" onchange="aktualisiere_progressbar()" type="file" name="plug-legend-img" accept="image/*" capture/>
<br>
<label class="test-function">Seriennummer</label><input class="test-function" onchange="aktualisiere_progressbar()" type="file" name="Serial-number-Img" accept="image/*" capture/>
<br>
<label class="test-function">Deckel mit Säckli</label><input class="test-function" onchange="aktualisiere_progressbar()" type="file" name="Top-Bag-img" accept="image/*" capture/>
<br>
<progress id="fortschritt" value="0" max="15"></progress>
<br><br>
<input type="submit" name="submit" value="Absenden">
</form>
</div>
</body>
</html>
<script>
function aktualisiere_progressbar() {
var anteil = 0;
for (var k = 0; k < document.forms[0].elements.length; k++) {
if (document.forms[0].elements[k].value != '') anteil++;
}
document.getElementById('fortschritt')
.value = anteil;
}
</script>
<?php
$db = new mysqli('localhost','root','','protokol');
if($db->connect_error):
echo 'Verbindung Fehlgeschlagen';
endif;
if(isset($_POST['submit'])):
$seriennummer = $_POST['Serial-number-Text'];
$object = $_POST['Object'];
$user = $_POST['User'];
$creator = $_POST['Creator'];
//Bilder Upload
move_uploaded_file($_FILES["inside-Img"]["tmp_name"], "images/".$seriennummer."-Innen.jpg");
move_uploaded_file($_FILES["top-Img"]["tmp_name"], "images/".$seriennummer."-Oben.jpg");
move_uploaded_file($_FILES["plug-legend-img"]["tmp_name"], "images/".$seriennummer."-Stecker.jpg");
move_uploaded_file($_FILES["Top-Bag-img"]["tmp_name"], "images/".$seriennummer."-Oben-mit-Stecker.jpg");
//
$absenden = $db->prepare("INSERT INTO kontrolliert (seriennummer,type,kontrolliert,gebaut,datum) Values(?,?,?,?,NOW())");
$absenden->bind_param('iiss',$seriennummer,$object,$user,$creator);
$absenden->execute();
endif;