title: How to get the sucess message in the same page after submitting the contact form?
body: <p>I have created the contact form using HTML and PHP. Also, the mail is coming correctly to mail id. But after the success message, it is redirecting to the <code>form.php</code> page can someone please help me. It is my first time trying to build a website.</p>
  
  <p>Here is my code for contact form:</p>
  
  <pre><code>&lt;form method="post" action="form.php"&gt;
      &lt;input name="name" required="required" placeholder="Your Name"&gt;
      &lt;input name="email" type="email" required="required" placeholder="Your Email"&gt;
  
      &lt;div class="clearfix"&gt; &lt;/div&gt;
      &lt;textarea name="message" cols="20" rows="5" required="required" placeholder="Message"&gt;&lt;/textarea&gt;
      &lt;div class="submit"&gt;
          &lt;input id="submit" name="submit" type="submit" value="Submit"&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>here is my <code>form.php</code> :</p>
  
  <pre><code>&lt;?php
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $from = 'From: agriindiaexp.com'; 
  $to = 'shridhar.kagi@gmail.com'; 
  $subject = 'Email Inquiry';
  
  $body = "From: $name\n E-Mail: $email\n Message:\n $message";
  
  if ($_POST['submit']) {
      if (mail ($to, $subject, $body, $from)) { 
         $success = "Message successfully sent";
      } else {
          $success = "Message Sending Failed, try again";
      }
  }
  ?&gt;
  </code></pre>
  
  <p>Please help me.</p>