title: PHP and html in the same html page
body: <p>I have a php file "send.php":</p>
  
  <pre><code>    &lt;?php
      $servername = "localhost";
      $username = "root";
      $password = "";
      $dbname = "RegisterDB";
      $conn = new mysqli($servername, $username, $password, $dbname);
      if ($conn-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
       } 
      $n=$_POST["name"];
      $a=$_POST["age"];
      $g=$_POST["gender"];
      $gr=$_POST["graduate"];
      $ad=$_POST["address"];
      if($_SERVER["REQUEST_METHOD"]=="POST"){
      $sql = "INSERT INTO RegTbl (name, age, gender,graduate,address)VALUES      ('".$n."','".$a."','".$g."','".$gr."','".$ad."')";
  
      if ($conn-&gt;query($sql) === TRUE) {
      echo "New record created successfully";
      } else {
      echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
      }
      }
      $conn-&gt;close();
      ?&gt;
  </code></pre>
  
  <p>and a html file form.html</p>
  
  <pre><code>    &lt;html&gt;
      &lt;body&gt;
      &lt;form method="post" action="send.php"&gt;
      Name &lt;input type="text" name="name"/&gt;&lt;br&gt;&lt;br&gt;
      Age &lt;input type="text" name="age"/&gt;&lt;br&gt;&lt;br&gt;
      Gender &lt;input type="checkbox" name="gender" value="male"/&gt; M &lt;input     type="checkbox" name="gender" value="female"/&gt; F&lt;br&gt;&lt;br&gt;
      Graduate &lt;input type="radio" name="graduate" value="yes"/&gt; YES &lt;input type="radio" name="graduate" value="no"/&gt; NO&lt;br&gt;&lt;br&gt;
      Address &lt;textarea name="address"&gt;&lt;/textarea&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="submit" name="submit_button" value="Send"/&gt;
     &lt;/form&gt;
     &lt;/body&gt;
     &lt;/html&gt;
  </code></pre>
  
  <p>And i am trying to embed both codes in a single html page:</p>
  
  <pre><code>     &lt;?php
      if(isset($_POST['submit'])) 
      { 
       $servername = "localhost";
       $username = "root";
       $password = "";
       $dbname = "RegisterDB";
       $conn = new mysqli($servername, $username, $password, $dbname);
        if ($conn-&gt;connect_error) {
        die("Connection failed: " . $conn-&gt;connect_error);
        } 
        $n=$_POST["name"];
        $a=$_POST["age"];
        $g=$_POST["gender"];
        $gr=$_POST["graduate"];
        $ad=$_POST["address"];
        if($_SERVER["REQUEST_METHOD"]=="POST"){
        $sql = "INSERT INTO RegTbl (name, age, gender,graduate,address)VALUES ('".$n."','".$a."','".$g."','".$gr."','".$ad."')";
  
        if ($conn-&gt;query($sql) === TRUE) {
      echo "New record created successfully";
         } else {
      echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
        }
        }
         }
       ?&gt;
       &lt;html&gt;
       &lt;body&gt;
       &lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
        Name &lt;input type="text" name="name"/&gt;&lt;br&gt;&lt;br&gt;
        Age &lt;input type="text" name="age"/&gt;&lt;br&gt;&lt;br&gt;
        Gender &lt;input type="checkbox" name="gender" value="male"/&gt; M &lt;input type="checkbox" name="gender" value="female"/&gt; F&lt;br&gt;&lt;br&gt;
        Graduate &lt;input type="radio" name="graduate" value="yes"/&gt; YES &lt;input type="radio" name="graduate" value="no"/&gt; NO&lt;br&gt;&lt;br&gt;
         Address &lt;textarea name="address"&gt;&lt;/textarea&gt;&lt;br&gt;&lt;br&gt;
         &lt;input type="submit" name="submit_button" value="Send"/&gt;
        &lt;/form&gt;
        &lt;/body&gt;
        &lt;/html&gt;
  </code></pre>
  
  <p>But this is not working, can anybody help me to find the error? and i save this third file as test.html</p>