I have a form that I'm passing via post to the phpmailer script, after sending it it redirects to another page saying if the form was sent or not, but it does not return to form page, I tried to do via ajax and I could not: / p>
would you have any way to submit the form by php and return the page only with php?
My form:
<div class="row contact">
<div class="col-lg-6 col-sm-6 ">
<form id="form" method="post" action="mail/phpmailer.php">
<input type="text" class="form-control" placeholder="Nome completo:" name="nome">
<input type="text" class="form-control" placeholder="E-mail:" name="email">
<input type="text" class="form-control" placeholder="Número para contato:" name="num">
<textarea rows="6" class="form-control" placeholder="Digite sua mensagem" name="msg"></textarea>
<input type="button" class="btn btn-success" name="enviar" value="Enviar">
</form>
</div>
</div>
PHPMailer Configuration:
<?php
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->setLanguage('pt');
$from = '[email protected]';
$fromName = '-';
$host ='smtp.umbler.com';
$username ='[email protected]';
$password ='-';
$port =587;
$secure =false;
$mail->isSMTP();
$mail->Host = $host;
$mail->SMTPAuth = true;
$mail->Username = $username;
$mail->Password = $password;
$mail->Port = $port;
$mail->SMTPSecure = $secure;
$mail->From = $from;
$mail->FromName = $fromName;
$mail->addReplyTo($from, $fromName);
$mail->addAddress('[email protected]', '-');
$mail->isHTML(true);
$mail->CharSet = 'utf-8';
$mail->WordWrap = 70;
$mail->Subject = 'Contato ';
$mail->Body = 'Nome: ' .$_POST['nome'] . 'Email: ' . $_POST['email'] . 'Numero: ' . $_POST['num'];
$mail->AltBody = $_POST['msg'];
$send = $mail->Send();
if($send)
echo 'E-mail enviado com sucesso!';
else
echo 'Erro : '.$mail->ErrorInfo;
?>
In this way after pressing on send it goes to the phpmailer.php page and informs if it was sent or not, but does not return to the form page ...