Form redirected to a second page, but I don’t receive the information submitted in the email

Asked

Viewed 120 times

2

I have a form called formulario.html that when it is successfully submitted, the person is redirected to a site thank page called agradecimentos.html. Everything was working fine, but when I go to my email and a secondary email I do not receive the information submitted in that same form.

Formulario.html:

<form action="suporte_email.php" method="post" name="formulario" id="formulario" >

<div class="row" id="row">
	 <div class="esq" id="esq">
	 
   
       <div class="conjunto" id="conjunto">
          <label for="MERGE0">Email para Contacto: <span>*</span></label><br>
	      <input autocapitalize="off" autocorrect="off" name="email" id="MERGE0" type="email"></input> 
       </div>
	  
       <div class="conjunto1" id="conjunto1">
	      <label for="nome">Nome de Contacto: <span>*</span></label><br>
	      <input id="nome" name="nome" type="text"></input>
	   </div>
	   
	  
	   <div class="conjunto2" id="conjunto2">
	      <label for="empresa">Nome da Empresa: </label><br>
	       <input id="empresa" name="empresa" type="text"></input>
	   </div>
	   
	  
	   <div class="conjunto3" id="conjunto3">
	       <label>Número de Contacto <span>*</span></label><br>
	       <input id="contacto" name="contacto" type="text"></input>
	   </div>
	   <br>
	  

	   <div class="conjunto4" id="conjunto4">
	       <label for="marca">Marca do Produto:<span>*</span></label><br>   
		   <select multiple name="marca" multiple id="marca"  width="570" style="width:570px;" required>
                 <option value="X">X</option>
                 <option value="Y">Y</option>
                 <option value="Z">Z</option>
                 <option value="E">E</option>
                 <option value="W">W</option>
                 <option value="Q">Q</option>
                 <option value="A">A</option>
                 <option value="S">S</option>
                 <option value="R">R</option>
                 <option value="C">C</option>
                 <option value="C">C</option>
                 <option value="D">D</option>
                 <option value="F">F</option>
                 <option value="G">G</option>
                 <option value="B">B</option>
                 <option value="H">H</option>
                 <option value="N">N</option>
                 <option value="J">J</option>
                 <option value="U">U</option>
                 <option value="I">I</option>
                 <option value="K">K</option>
                 <option value="M">M</option>
                 <option value="Outra">Outra</option>
            </select>
	   </div>
	  
	   
	  
	   <div class="conjunto5" id="conjunto5">
	        <label for="other">Se escolheu "Outra", indique qual:</label><br>
	        <input id="other" class="text control" name="other" type="text"> </input>
	   </div>
	   		   
	  
	   <div class="conjunto6" id="conjunto6">
		  <label for="serial_number">Número de Série:<span>*</span></label><br>
	      <input id="serial_number" name="serial_number" id="serial_number" type="text"></input>
	   </div>
	  
	  </div>
	  
	  <div class="dir" id="dir">
	                            
	  
	  <div class="conjunto7" id="conjunto7">
	   <label for="garantia">Garantia</label><br>
	     <div>
		 <input id="radio1" type="radio" name="radio"  value="Sim">
		    <label for="radio1"><span><span></span></span> Sim </label>
		 </div>
		 
		 
	     <div>
		   <input id="radio2" type="radio" name="radio"  value="Não">
		    <label for="radio2"><span><span></span></span> Não </label>
		 </div>
	  </div>
	  
	  <br><br><br><br>
	  
	  <div class="conjunto8" id="conjunto8">
	   <label for="contrato">Contrato</label><br>
	      <div>
		    <input id="checkbox1" type="checkbox" name="checkbox[]"  value="Sim">
		     <label for="checkbox1"><span></span> Sim </label>
		  </div>
          
		  <div>
		    <input id="checkbox2" type="checkbox" name="checkbox[]"  value="Não">
			 <label for="checkbox2"><span></span> Não </label>
		  </div>
		  
		  
	  </div>
	  
	 
	  
	  <br><br><br><br><br><br>
	 <div id="separa" class="separa">
	  <div class="conjunto9" id="conjunto9">
	       <label for="permissoes">Tipo de Suporte:<span>*</span></label><br> 
		    <select multiple name="permissoes" multiple id="permissoes" width="570" style="width:570px;" required>
                 <option value="Pedido de Informação Técnica">Pedido de Informação Técnica</option>
                 <option value="Pedido de Assistência Técnica">Pedido de Assistência Técnica</option>
                 <option value="Reclamação Técnica">Reclamação Técnica</option>
                 <option value="Seguimento de Pedido de Informação Técnica">Seguimento de Pedido de Informação Técnica</option>
                 <option value="Seguimento de Pedido de Assistência Técnica">Seguimento de Pedido de Assistência Técnica</option>
            </select>
	  </div>
	   
	   
	   
	   <div class="conjunto10" id="conjunto10">
 		   <label for="descricao_avaria">Descrição da Avaria:</label><br>
           <div class="styled" id="styled">  <textarea  name="descricao_avaria" cols="62" rows="10"></textarea> </div>
	   </div>
	  </div>


<input type="submit" name="submit" class="button" value="Enviar" />
</form>

Like I said, agradecimentos.html is a simple page redirecting the person to a site thanks page.

The corresponding php code is suporte_email.php. The problem is that the information placed in this form is not sent to the corresponding email. I have already reviewed the code of .php and I can’t understand what’s going on.

support_email.php:

<?php
$crlf = "\r\n";
//Get Data
    $nome = $_POST['nome'];                    
    $empresa = $_POST['empresa'];              
    $contacto = $_POST['contacto'];            
    $email = $_POST['email'];                  
    $marca = $_POST['marca'];                   
    $other = $_POST['other'];                    
    $serial_number = $_POST['serial_number'];     
    $garantia = $_POST['garantia'];               
    $contrato = $_POST['contrato'];             
    $permissoes = $_POST['permissoes'];           
    $descricao_avaria = $_POST['descricao_avaria'];
    $checkbox = $_POST["checkbox"];
    $radio = $_POST["radio"];

 // Parse/Format/Verify Data
       $to      = "[email protected], $email"; 
       $from    = "Suporte";
       $subject = "Formulário de Suporte";

       $email_body = "$crlf De: $nome$crlf Email: $email$crlf Assunto: $subject$crlf$crlf Empresa: $empresa$crlf Contacto: $contacto$crlf Marca: $marca$crlf Outra: $other$crlf Número de Série: $serial_number$crlf Garantia: $radio$crlf Contrato: $checkbox$crlf Tipo de Suporte: $permissoes$crlf$crlf Descrição da Avaria: $descricao_avaria";

       // Setup EMAIL headers, particularly to support UTF-8
       // We set the EMAIL headers here, these will be sent out with your message
       // for the receiving email client to use.
       $headers ='From: '.$to . $crlf . 
                  'Reply-To: ' .$to  . $crlf . 
                  'Content-Type: text/plain; charset=UTF-8' .  $crlf .
                  'X-Mailer: PHP/' . phpversion();



       // Then we pass the headers into our mail function
       mail($to, $subject, $email_body, $headers);
       header('Location: agradecimentos.html');
?>

P.S: Warranty is a radio button and Contract is a checkbox. If you see any more of the wrong code, tell me pfv. Thank you very much

  • Add the html from within <form> complete.

  • @Guilhermenascimento already added the rest of the <form code>

  • From what I understand suporte_email.php you’re not getting the data, is that it? you’ve tried method of the form with post capital?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.