title: Cannot obtain value from PHP form on clicking "submit"
body: <p>I'm new to PHP, and attempting to create a simple form using HTML and PHP. I'm using Apache Netbeans with XAMPP to run the PHP file on Google Chrome. Here's the code:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;An example website&lt;/h1&gt;
          &lt;p&gt;This is an example website to test HTML &amp; PHP&lt;/p&gt;
          &lt;form action="myform.php" method="post"&gt;
              Name: &lt;input type="text" name="name"&gt;&lt;br&gt;
              &lt;input type="submit" name="formSubmit" value="Submit"&gt;
          &lt;/form&gt;a
          &lt;?php
          if($_POST['formSubmit'] == "Submit") {
              echo $_POST['name'];
          }                 
          ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>So I've created a form on the HTML page, and I'm trying to print the value that I've typed in on clicking the Submit button. I'm sure I'm missing something basic here, but it's not working and I'm not sure why. Here's what happens when I load the page and type my name into the form field:</p>
  
  <p><a href="https://i.stack.imgur.com/pdo8x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pdo8x.png" alt="enter image description here"></a></p>
  
  <p>Here is the error in the above image in text:</p>
  
  <blockquote>
    <p>Notice: Undefined index: formSubmit in C:\xampp\htdocs\TestPHP\index.php on line 20</p>
  </blockquote>
  
  <p>Then when I click the "Submit" button, this happens:</p>
  
  <p><a href="https://i.stack.imgur.com/S6MQa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S6MQa.png" alt="enter image description here"></a></p>
  
  <p>Here is the error in the above image in text:</p>
  
  <blockquote>
    <p>Object not found! The requested URL was not found on this server. The
    link on the referring page seems to be wrong or outdated. Please
    inform the author of that page about the error.</p>
    
    <p>If you think this is a server error, please contact the webmaster.</p>
    
    <p>Error 404 localhost Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6</p>
  </blockquote>
  
  <p>Can anyone clarify what is actually happening here, and what I would need to do in order to grab the value entered in the form field?</p>