0
How can I add an attachment that the person inserts into the form?
<?php
$action=$_REQUEST['action'];
if ($action=="") /* display the contact form */
{
?>
<center><h1>Formulário de forrnecedores</h1><br><br>
<form action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Seu nome:<br>
<input name="name" type="text" value="" size="30"/><br>
Seu e-mail:<br>
<input name="email" type="text" value="" size="30"/><br>
Nome do cliente:<br>
<input name="cliente" type="text" value="" size="30"/><br>
Marca/Tipo do tapete:<br>
<input name="tapete" type="text" value="" size="30" /><br>
Medidas:<br>
<input name="medidas" type="text" value="" size="30"/><br>
Detalhes Adicionais:<br>
<textarea name="message" rows="7" cols="30"></textarea><br>
<input type="submit" value="Send email" class="btn btn-primary"/>
</form>
<?php
}
else /* send the submitted data */
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
$tapete=$_REQUEST['tapete'];
$medidas=$_REQUEST['medidas'];
$cliente=$_REQUEST['cliente'];
if (($name=="")||($email==""))
{
echo "Todos os campos devem ser preenchidos. Por favor, <a href=\"\">complete o formulário novamente</a>.";
}
else{
$from="De: $name<$email>\r";
$subject="Formulário FacilityCom";
mail("[email protected]", $subject, "Tipo e marca: $tapete \nMedidas: $medidas \nCliente: $cliente\n $from", $from);
echo "<br> Email enviado!!";
}
Did this answer not help you http://answall.com/a/11426/3635 ? It explains both the function
mail()
native as with Phpmailer, if you want to with the native function, then it seems to me that the answer is sufficient. I know you don’t think it’s duplicate, but the answer there seems to be what you’re looking for.– Guilherme Nascimento
It is best to use Phpmailer or Swift mail are two libraries that make sending email with attachment simpler
– rray