Q:

isset($_POST['submit']) not working now

This was working, but right now when I got back to this, it stopped working.
I can't seem to figure out what the problem is. Please help.
    <?php
    if(isset($_POST['submit']))
    {
        require("dbconn.php");
        $filename = $_POST['filename'];
        $name = $filename . pathinfo($_FILES['ufile']['name'],PATHINFO_EXTENSION);
        //$name = $_FILES['ufile']['name'];
        echo $name;
        //$size = $_FILES['file']['size']
        //$type = $_FILES['file']['type']

        $tmp_name = $_FILES['ufile']['tmp_name'];
        $error = $_FILES['ufile']['error'];

        if (isset ($name)) 
        {
            if (!empty($name)) 
            {
                $location = 'uploads/';

                if  (move_uploaded_file($tmp_name, $location.$name))
                {
                    $filename = $_POST['filename'];
                    $filepath = $location.$name;
                    $advname = $_POST['advname'];
                    $year = $_POST['year'];
                    $cname = $_POST['cname'];
                    $ctype = $_POST['ctype'];
                    $sqlq = "INSERT INTO file (filename, filepath, advname, year, cname, ctype) VALUES ('".$filename."','".$filepath."','".$advname."','".$year."','".$cname."','".$ctype."');";
                    $result = mysql_query($sqlq);
                    if(!$result)
                    {
                        die("Error in connecting to database!");
                    }
                }
            } 
        }
    }
?>

<form id="form1" method="POST" action="" enctype="multipart/form-data">
            <label>File Name</label>
            <input id="filename" name="filename" type="text" value=""/><br>

            <label>Advocate Name</label>
            <select name = "advname">
                <option value=""></option>
                <option value="Adv 1">Adv 1</option>
                <option value="Adv 2">Adv 2</option>
                <option value="Adv 3">Adv 3</option>
            </select><br>

            <label>Year<label>
            <input id="year" name="year" type="date"><br>

            <label>Company Name</label>
            <input id="cname" name = "cname" type="text"><br>

            <label>Court Type</label>
            <input id="ctype" type="text" name = "ctype"><br>

            <label>Scan</label>
            <button type="button" class="btn btn-default" onclick="scanSimple();">Simple Scan</button>
            <button type="button" class="btn btn-info" onclick="scan();">Scan</button><br>

            <label>Upload</label>
            <input type="file" name="ufile" id="ufile"><br>

            <input type="submit" name="submit" value="Submit" onclick="submitForm1();">
        </form>

Both these code are a part of the same file. 
Please let me know of where I could be going wrong, because I can't seem to find any mistake.
I've tried echoing inside the if statement and it doesn't display anything. 

A:

you are missing action="current file name" in first line of form tag...
   <form id="form1" method="POST" action="current file name/example.php"     enctype="multipart/form-data">

OR use this.
<form id="form1" method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>"     enctype="multipart/form-data">

