PHP提交按钮检查不起作用

I am trying to get an isset so the code stops if the sumbit button in my form is not clicked yet. However everything I do leads it to just think that the button is never pressed. I could use some help. Sorry for the giant code dump.

if (!$gn===null) is my sad attempt to try to get it to work.

Thank You

<!--*** Form Start ***-->    
<form method="post" name="Lab4Form" id="Lab4Form" 
      action="genre_aries0653.php">
    <fieldset>
        <legend>Select by Genre</legend>

        <!-- Genre -->
        <label for="genre">Genre: </label> 
        <input type="text" name="genre" id="genre" size="50" 
                             maxlength="35" placeholder= "Freedom" 
                             required="required"><br><br>   

        <!--Submit/Reset Buttons -->    
        <input type="submit" value="Submit" id="submit"> 
        <input type="reset">
    </fieldset>
</form>



 <?php
 //require_once functions
 require_once ("inc_functions_aries0653.php");
 //require_once connect to db, selects db 
 require_once("conn_aries0653.php");



 $gn = (filter_input(INPUT_POST, 'genre'));
 $genre     = (ucwords(strtolower(trim($gn))));



if (!$gn===null) {

} else {
    die;
}



 MultiCheck ($genre);



 //Checks if connected to database successfully
 $dbConnection = new mysqli($sn, $un, $pw, $dbName);

 if ($dbConnection->connect_error)
 {
die ("Connection Failed: ".$dbConnection->connect_error);
 }


 //Declares the sort and SQL string
 $sort = "author_lastName";
 //SQL: Select all from table, where genre = user input genre, sort
 $sqlQuery = 
 "SELECT * FROM $tableName WHERE genre= '$genre' ORDER BY $sort"; 

 //run query
 $result = $dbConnection->query($sqlQuery);


 //check if there is any data
 if ($result-> num_rows > 0)
 {
//Prints the table head which are the fields of the table
$totalRecords = $result-> num_rows;
print("<table border=\"1\"<tr><header><h1>Book Inventory</h1></header></tr>".
        "<tr><th>Book Title</th>".
        "<th>Author's First Name</th>".
        "<th>Author's Last Name</th>".
        "<th>Genre</th>".
        "<th>ISBN13</th>".
        "<th>Publisher</th>".
        "<th>Copyright Year</th>".
        "<th>Price</th></tr>");

while($record = $result->fetch_assoc())
{

 //Loops through the table to retrieve all the records of the given fields
    print("<tr><td>{$record['title']}</td>");
    print("<td>{$record['author_firstName']}</td>");
    print("<td>{$record['author_lastName']}</td>");
    print("<td>{$record['genre']}</td>");
    print("<td>{$record['ISBN']}</td>");
    print("<td>{$record['publisher']}</td>");
    print("<td>{$record['yearPublished']}</td>");
    //format price to have 2 decinmal places and a "$" sign
    print("<td class=\"number\">"."$".number_format("{$record['price']}",2)."</td></tr>
");

 }
    //Tell user how many records are returned
    print("<tr><td colspan=8 class=message>Your query returned ".
            $totalRecords." books.</td></tr>");
    print("</table>
");
 } else {
        print("No books for you!");
        die;
   }


 //Close db connection
 $dbConnection -> close();       

 ?>`

You may need this

<input type="submit" name="btnSubmit" value="Submit" id="submit"> 

then check if the button is clicked

if(isset($_POST['btnSubmit'])){
//Your code here if the button is clicked
}else{
//The button is not clicked
}

When you will use any form submission for showing next phase, you have two options -

1) you need to reload this page, check submitted data & show next phase.

2) or you need to use AJAX for same work, it will not reload your page, but fulfill your requirements.

It's better to use AJAX to check whether submit button pressed or not, if pressed then set any variable(suppose $var1) & check it using isset($var1) for showing next part of your page.