title: Changing the value of a Form Submit Button to say submitted after form submits
body: <p>I have a contact form on my website. I'd like to change the text of the submit button to say "submitted" after the form has successfully submitted, and maybe even make it say "submitting" while the form is submitting. I am unsure of how to do this, i could do an onclick event that would change the text, but not the route i want to take as the message could fail to send and the button would still say submitted. </p>
  
  <p>Here is my html for the form</p>
  
  <pre><code>&lt;form method="post" action="contact.php"&gt;
      &lt;input type="text" name="name" placeholder="Name"&gt;&lt;br&gt;
      &lt;input type="email" name="email" placeholder="Email"&gt;&lt;br&gt;
      &lt;textarea rows="8" cols="65" name="message"placeholder="Message"&gt;&lt;/textarea&gt;&lt;br&gt;
      &lt;input id="submit" type="submit" name="submit" value="Let's Get In Touch"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and here is my php code:</p>
  
  <pre><code>&lt;?php
  
      $name = $_POST['name'];
      $email = $_POST['email'];
      $message = $_POST['message'];
      $from = 'From: Portfolio Website'; 
      $to = 'kyle.a.binger@gmail.com'; 
      $subject = 'Message From Personal Site';
  
      $body = "From: $name\n E-Mail: $email\n Message:\n $message";
  
      if ($_POST['submit']) {
          if (mail ($to, $subject, $body, $from)) { 
              echo '&lt;p&gt;Your message has been sent!&lt;/p&gt;';
          } else { 
              echo '&lt;p&gt;Something went wrong, go back and try again!&lt;/p&gt;'; 
          }
      }
  ?&gt;
  </code></pre>
  
  <p>Is there a way to do this with my existing php code? Thanks in advance for any help.</p>