title: PHP Mail how to show success box on page
body: <p>I am new to PHP, and I made this PHP Mail, for a regular contact form... When the form is completed, the page is redirected and displays "The message was sent succesfully". The problem is, i don't want the page to redirect.. I want to show a feedback on the index, something like a success modal box or a simple text underneath the form "your message was sent"... </p>
  
  <p>Any ideas on how to do this?</p>
  
  <pre><code>&lt;?php
  $nome = $_POST['nome'];
  $email = $_POST['email'];
  $emaildestino = 'contato@zerodesign.com.br';
  $email_from='contato@zerodesign.com.br';
  $mensagem = $_POST['mensagem'];
  $assunto = $_POST['assunto'];
  $telefone = $_POST['telefone'];
  $titulo = 'Mensagem - TESTE';
  
  
  
  
   &lt;?php
  $nome = $_POST['nome'];
  $email = $_POST['email'];
  $emaildestino = 'contato@zerodesign.com.br';
  $email_from='contato@zerodesign.com.br';
  $mensagem = $_POST['mensagem'];
  $assunto = $_POST['assunto'];
  $telefone = $_POST['telefone'];
  $titulo = 'Mensagem - TESTE';
  
  
  
  
  $juntando = '&lt;p&gt;Esta mensagem foi enviada pelo site&lt;/p&gt;&lt;br/&gt;
  &lt;p&gt;&lt;b&gt;Nome:&lt;/b&gt; '.$nome.'&lt;/b&gt;&lt;/p&gt;&lt;br&gt;
  &lt;p&gt;&lt;b&gt;Email:&lt;/b&gt; '.$email.' &lt;/b&gt;&lt;/p&gt;&lt;br&gt;
  &lt;p&gt;&lt;b&gt;Telefone:&lt;/b&gt; '.$telefone.'&lt;/p&gt; &lt;/br&gt;
  &lt;p&gt;&lt;b&gt;Mensagem:&lt;/b&gt;&lt;/p&gt;
  &lt;p&gt;&lt;i&gt;'.$mensagem.'&lt;/i&gt;&lt;/p&gt;
  &lt;hr&gt;';
  
  $headers = 'MIME-Version: 1.0' . "\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
  $headers .= "From: $email_from " . "\n";
  
  $envio = mail($emaildestino, $titulo, $juntando, $headers, "-r".$email_from);
  
  if($envio)
  echo "Mensagem enviada com sucesso";
  else
   echo "A mensagem nãpode ser enviada";
   ?&gt;
  </code></pre>
  
  <p>Here is my form:</p>
  
  <pre><code>&lt;form method="POST" name="contactform" action="envia.php"&gt; 
  &lt;p&gt;&lt;input id="inputt" type="text" name="nome" placeholder="Nome" id="nome" &gt;&lt;/p&gt;
  &lt;p&gt;&lt;input  id="inputt" type="text" name="email" placeholder="Email" id="email"&gt;&lt;/p&gt;
  &lt;p&gt;&lt;input class="inputt" type="text" name="telefone" placeholder="Telefone" id="telefone"&gt;     &lt;/p&gt;
  &lt;p&gt;&lt;textarea id="mensagem" name="mensagem" rows="5" cols="40" placeholder="Mensagem" id="mensagem"&gt;&lt;/textarea&gt;&lt;/p&gt;
  
  
  &lt;input id="button" type="submit" value="Enviar"&gt;&lt;br&gt;
  &lt;/form&gt;
  </code></pre>