PHP表单处理图像和数据(偏差日志)

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!

You need to use Handling file uploads. To my mind, it is not a good idea to store images in a database. It is better to put uploaded files to directory and in a database to store a image path or filename.

First you add image path into database.when you want to retrieve image from database then use query like below:

<?php
    $retrieve = "SELECT image FROM tbl_name";
    $exe = mysqli_query($conn,$retrieve);
?>
<form method = "post" action = "<?php $_PHP_SELF ?>" id="form1" enctype="multipart/form-data">
    <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>  
</form>

got it working, thanks for the advice!

<?php
     if(isset($_POST['update'])) {
        $dbhost = 'localhost';
        $dbuser = 'root';
        $dbpass = '';
        $tbl_name="heijsDB";

        $conn = mysql_connect($dbhost, $dbuser, $dbpass);


        $constatering = $_POST['constatering'];
        $radio = $_POST['radio'];
        $actie = $_POST['actie'];
        $date = $_POST['geplande_datum'];
        $verant = $_POST['verantwoordelijke'];
        $toelichting = $_POST['toelichting'];
        $filename=$_FILES['file']['name'];
        $filetype=$_FILES['file']['type'];

   if($filetype=='image/jpeg' or $filetype=='image/png' or $filetype=='image/gif')
{
        move_uploaded_file($_FILES['file']['tmp_name'],'uploads/'.$filename);
        $filepath="uploads/".$filename;

        if(! $conn ) {
           die('Could not connect: ' . mysql_error());
        }           
        $sql = "INSERT INTO logboek_afwijkingen (image, constatering, besmetting, actie, datum_gepland, verantwoordelijke, toelichting) VALUES ('$filepath', '$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" enctype="multipart/form-data">
    <fieldset id="f1"><b>Logboek afwijkingen</b></fieldset>
        <table width= "600" border="1" cellspacing="1" cellpadding="1" class="w3-container w3-table">

            <tr><td width="200"><b>upload foto</b></td><td></td> <td width="100"><input type="file" size="3" name="file"></td></tr>


            <tr><td width="200"><b>constatering</b></td><td></td> <td width="100"><input type="text" name="constatering" 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']; ?>"> 
       </form>

        <?php
     }