So i've been asked to make some sort of deviation log for the company, which means every thing that is wrong needs to be noted.
It needs an unique ID, date, text, and importantly an image of the deviation. my question is if and how i can make a form and put all of them in the database, then make a table and show the data with the uploaded image.
<?php
if(isset($_POST['update'])) {
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$tbl_name="heijsDB";
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$volgnr = $_POST['volgnr'];
$constatering = $_POST['constatering'];
$radio = $_POST['radio'];
$actie = $_POST['actie'];
$date = $_POST['geplande_datum']
$verant = $_POST['verantwoordelijke'];
$toelichting = $_POST['toelichting']
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = "INSERT INTO logboek_afwijkingen (volgnr, ?IMAGE?, constatering, besmetting, actie, datum_gepland, verantwoordelijke, toelichting) VALUES ($volgnr, $constatering, ... , $radio, $actie, $date, $verant, $toelichting)" ;
mysql_select_db('HeijsDB');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not update data: ' . mysql_error());
}
echo "Form send.";
mysql_close($conn);
}else {
?>
<form method = "post" action = "<?php $_PHP_SELF ?>" id="form1">
<fieldset id="f1"><b>Logboek afwijkingen</b></fieldset>
<table width= "600" border="1" cellspacing="1" cellpadding="1" class="w3-main w3-table">
<tr><td width="200"><b>volgnummer</b></td> <td></td><td><input type="number" size="3" name="volgnr"></td></tr>
<tr><td width="200"><b>upload foto</b></td><td></td> <td width="100"><input type="file" accept="image/jpeg" size="3" name="picture"></td></tr>
<tr><td width="200"><b>constatering</b></td><td></td> <td width="100"><input type="" size="3"></td></tr>
<tr><td width="100"><b>kans op acute besmetting</b></td><td></td> <td><input type="radio" value="ja" class="w3-radio" name="radio"> Ja<br>
<input type="radio" value="nee" class="w3-radio" name="radio"> Nee<br></td></tr>
<tr><td width="100"><b>corrigerende actie</b></td><td></td> <td><input type="textarea" size="3" name="actie"></td></tr>
<tr><td width="100"><b>geplande datum</b></td><td></td> <td><input type="date" size="3" name="geplande_datum"></td></tr>
<tr><td width="100"><b>verantwoordelijke</b></td><td></td> <td><input type="text" size="3" name="verantwoordelijke"></td></tr>
<tr><td width="100"><b>Toelichting</b></td><td></td> <td><input type="text" size="3" name="toelichting"></td></tr>
</table>
<input type="submit" name="update" value="update" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<?php
}
this is my code, hope you guys can help me out!