Good Evening (Here in Brazil, at least),
I Have a form with some checkbox and file input for images, but when I Submit it, nothing happens.
What could be wrong?
Form:
<form class="form" enctype="multipart/form-data" method="post" action="envia_email.php">
<fieldset>
<fieldset class="grupo">
<div class="campo">
<label for="nome" id="nome">Nome Completo</label>
<input type="text" id="nome" name="nome" style="width: 10em" value="" />
</div>
</fieldset>
<div class="campo">
<label for="email">E-mail</label>
<input type="text" id="email" name="email" style="width: 13em" value="" />
</div>
<div class="campo">
<label for="email">Local</label>
<input type="text" id="local" name="local" style="width: 13em" value="" />
</div>
<div class="campo">
<label for="telefone">Telefone</label>
<input type="text" id="telefone" name="telefone" style="width: 13em" value="" />
</div>
<input TYPE="checkbox" NAME="whatsapp" VALUE="Whatsapp"> Whatsapp <br><br>
<div class="campo">
<label for="idade">Idade</label>
<input type="text" id="Idade" name="idade" style="width: 3em" value="" />
</div>
<div class="campo">
<label for="cache">Cachê</label>
<input type="text" id="cache" name="cache" style="width: 10em" value="" />
</div>
<div class="campo">
<label for="cache">Atendimento</label>
<input TYPE="checkbox" NAME="atendimento[]" VALUE="Hotéis e Motéis"> Hotéis e Motéis <br><br>
<input TYPE="checkbox" NAME="atendimento[]" VALUE="Residência"> Residência <br><br>
<input TYPE="checkbox" NAME="atendimento[]" VALUE="Local Próprio"> Local Próprio <br><br>
</div>
<div class="campo">
<label for="cache">Atendo</label>
<input TYPE="checkbox" NAME="atendo[]" VALUE="Homens"> Homens <br><br>
<input TYPE="checkbox" NAME="atendo[]" VALUE="Mulheres"> Mulheres <br><br>
<input TYPE="checkbox" NAME="atendo[]" VALUE="Casais"> Casais <br><br>
</div>
<div class="campo">
<label for="cache">Formas de pagamento</label>
<input TYPE="checkbox" NAME="pagamento[]" VALUE="Dinheiro"> Dinheiro <br><br>
<input TYPE="checkbox" NAME="pagamento[]" VALUE="Cheque"> Cheque <br><br>
<input TYPE="checkbox" NAME="pagamento[]" VALUE="Cartão"> Cartão <br><br>
</div>
<div class="campo">
<label for="mensagem">Atendimento e serviços</label>
<textarea rows="6" style="width: 15em" id="mensagem" name="mensagem"></textarea>
</div>
<div class="campo">
<label for="img">Imagem 1</label>
<input type="file" name="imagem[]" style="width: 10em" />
</div>
<div class="campo">
<label for="img">Imagem 2</label>
<input type="file" name="imagem[]" style="width: 10em" />
</div>
<div class="campo">
<label for="img">Imagem 3</label>
<input type="file" name="imagem[]" style="width: 10em" />
</div>
<div class="campo">
<label for="img">Imagem 4</label>
<input type="file" name="imagem[]" style="width: 10em" />
</div>
<div class="campo">
<label for="img">Imagem 5</label>
<input type="file" name="imagem[]" style="width: 10em" />
</div>
<div class="campo">
<label for="img">Imagem 6</label>
<input type="file" name="imagem[]" style="width: 10em" />
</div>
<div class="campo">
<label for="img">Imagem 7</label>
<input type="file" name="imagem[]" style="width: 10em" />
</div>
<div class="campo">
<label for="img">Imagem 8</label>
<input type="file" name="imagem[]" style="width: 10em" />
</div>
<button type="submit" name="enviar">Enviar</button>
</fieldset>
</form>
PHP
<?php
$nome = $_POST['nome'];
$email = $_POST['email'];
$local = $_POST['local'];
$telefone = $_POST['telefone'];
$whatspapp = $_POST['whatsapp'];
$idade = $_POST['idade'];
$cache = $_POST['cache'];
$atendimento = $_POST['atendimento'];
$atendo = $_POST['atendo'];
$pagamento = $_POST['pagamento'];
$mensagem = $_POST['mensagem'];
$imagem = $_FILES['imagem'];
$para = "email@email.com";
$bound = "XYZ-". date('dmYis') ."-ZYX";
$texto = "--$bound
";
$texto .= "Content-Transfer-Encoding: 8bits
";
$texto .= "Content-Type: text/html; charset=\"ISO-8859-1\"
";
$texto .= "<b>Nome: </b>". $nome ."</br>";
$texto .= "<b>E-mail: </b>". $email ."</br>";
$texto .= "<b>Local: </b>". $local ."</br>";
if($whatsapp != '') {
$texto .= "<b>Whatsapp:</b> Sim</br>";
};
$texto .= "<b>Idade: </b>". $idade ."</br>";
$texto .= "<b>Cachê: </b>". $cache ."</br>";
foreach($atendimento as $Atendimento) {
$texto .= $Atendimento .", ";
};
$texto .= "</br>";
foreach($atendo as $Atendo) {
$texto .= $Atendo .", ";
};
$texto .= "</br>";
foreach($pagamento as $Pagamento) {
$texto .= $Pagamento .", ";
};
$texto .= "</br>";
$texto .= "<b>Mensagem: </b>". $mensagem ."</br>";
$txt1 = "email@email.com";
$texto .= "--$bound
";
foreach($imagem as $Imagem) {
if(file_exists($Imagem['tmp_name'])) and !empty($Imagem) {
$fp = fopen($Imagem['tmp_name'],"rb");
$anexo = fread($fp,filesize($Imagem['tmp_name']));
$anexo = base64_encode($anexo);
fclose($fp);
$anexo = chunk_split($anexo);
$texto .= "Content-Type: ".$Imagem["type"]."
";
$texto .= "Content-Disposition: attachment; filename=\"".$Imagem["name"]."\"
";
$texto .= "Content-Transfer-Encoding: base64
";
$texto .= "$anexo
";
};
};
$texto .= "--$bound--
";
$headers = "MIME-Version: 1.0
";
$headers .= "From: \"$nome\" <$email>
";
$headers .= "Bcc: {$txt1}
";
$headers .= "Content-type: multipart/mixed; boundary=\"$bound\"
";
$headers .= "$bound
";
mail($para,"Contato Anuncio",$texto,$headers);
?>
I Asked some friends and they all told it's okay, but still not working. Help!
Regards.