I'm creating a form with select, input, radio buttons and checkboxes and others. Part of the code where is the part of my question is like this:
formulario.html
<form action="suporte_email.php" method="post" name="formulario" id="formulario" >
<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>
</form>
suporte_email.php
//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 = "teste@gmail.com";
$from = '';
$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: $garantia$crlf Contrato: $contrato$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: ' . $from . $crlf .
'Reply-To: ' . $email . $crlf .
'Content-Type: text/plain; charset=UTF-8' . $crlf .
'Para: Website' . $to . $crlf .
'X-Mailer: PHP/' . phpversion();
// Then we pass the headers into our mail function
mail($to, $subject, $email_body, $headers);
header('Location: agradecimentos.html');
}
Basically the variables from the radio button and from the checkbox don't appear when i receive the email. I want to receive the selected value from the radio and from the checkbox.
P:S: Also tried to change where is $garantia for $radio and where is $contrato for $checkbox.
Thanks for the help in advance! :D
Aucun commentaire:
Enregistrer un commentaire