Hello, I'm using a function for uploading images on the server and database. The only problem is that I can not properly put to the various alerts for required fields or missing and with happened insertion message.

For the moment my code, obviously wrong, is so:

include_once 'function/upload.php';

if(isset($_POST['submit'])) {

        $error = "Manca il titolo";

        $error = "Manca la descrizione";

    if(!empty($_FILES['image']['name'])) {
        //call thumbnail creation function and store thumbnail name
        $upload_img = imgUpload('image','uploads/','',TRUE,'uploads/thumbs/','260','260');
        //full path of the thumbnail image
        $thumb_src = 'uploads/thumbs/'.$upload_img;
        $success = "Caricato!";

Which is the right syntax to write the errors in this case?

your script is executed when server receives data via post at the moment you can't do anything on client side
you have 2 choices

`1. validate data before submit using jquery or js    see docs for .onsubmit event`
  1. if there any error you can redisplay the page showing the error message.