1
I’m trying to send more of a checkbox marked by email, with Phpmail, I can only send the last item marked, I tried to do an if with foreach more did not help, maybe I still can not do, as I can put this function in this checkbox below:
<?php
if(!empty($_POST['checkbox'])) {
foreach($_POST['checkbox'] as $check) {
echo $check . "<br>";
}}
$Nome = $_REQUEST['Nome'];
$Tel = $_REQUEST['Tel'];
$Email = $_REQUEST['Email'];
$Mensagem = $_REQUEST['Mensagem'];
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "Contato do site Webwork"; // Assundo
$mail->Body = " Nome:</strong> $Nome \n<br />". // Usuario
" Tel.:</strong> $Tel \n<br />".
" Email:</strong> $Email \n<br /><br />". // Email
" Mensagem:</strong> $Mensagem \n<br />"; // Mensagem
I wanted to print the reply of more than one check in the body of the email, as I do it?
<form action="executa.php" method="post" name="form1">
<input type="checkbox" name="checkbox[]" value="Primeiro" />
<input type="checkbox" name="checkbox[]" value="Segundo" />
<input type="checkbox" name="checkbox[]" value="Terceiro" />
<input type="checkbox" name="checkbox[]" value="Quarta" />
<button type="submit" value="Enviar">Enviar</button>
</form>
In your checkbox field form you must have the
name
followed by square brackets:name="produtos[]"
– rray
There is more than one $_POST['name'] ?
– Renato Junior
Already had, I edited to put the form.
– Léo Cunha
I can give an echo, and it appears to me, but in the email I do not know how to send.
– Léo Cunha