Feedback message in php contact form

0

Good evening, I have a contact form that is working perfectly. However, after sending the email, the page goes blank and I do not have a feedback message. I would like to display a modal with the message. Here is my code:

<?php    
$nome = $_POST['nome'];
$email = $_POST['email'];
$cpf = $_POST['cpf'];
$moeda = $_POST['moeda'];
$valor = $_POST['valor'];
$local = $_POST['local'];
$formcontent=" Nome: $nome \n Email: $email \n CPF: $cpf \n Moeda: $moeda \n Valor: $valor \n Local: $local";
$recipient = "[email protected]";
$subject = "Contato Delivery SP";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");

if ($formcontent == 1){ 
  echo "<script>$('#form-modal').modal('show')</script>"; 
}else{
  echo "<script>$('#form-modal-2').modal('show')</script>"; 
} 

?>
    
asked by anonymous 26.04.2016 / 04:53

1 answer

1

If you say that a blank screen is displayed, I assume you are not using AJAX. In this case, you should keep in mind that the content of the page where the form is, after submission is completely "redefined".

You should add this in the code

<!-- Inclusão das bibliotecas-->
<link rel....bootstra.css
<scr...bootstrap.js
<scr...jquery.js

<!-- código dos modals(ou ais) -->
<div class="modal-1"..
 ......
<div class="modal-2...
 ......

<!-- Aqui vai o script que você postou -->
<?php    
$nome = $_POST['nome'];
$email = $_POST['email'];
$cpf = $_POST['cpf'];
$moeda = $_POST['moeda'];
...
    
26.04.2016 / 05:26