Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
Diogo Freitas

qual o erro?

Question

fiz um código para um formulário.

O que tá mal?

<?php

//pego os dados enviados pelo formulario
$empresa = $_POST["empresa"];
$resp = $_POST["resp"];
$contacto = $_POST["contacto"];
$email_form = $_POST["email_form"];
$select_tamanho = $_POST["select_tamanho"];
$select_tipo = $_POST["select_tipo"];
$select_local = $_POST["select_local"];
$select_tempo = $_POST["select_tempo"];
$coment = $_POST["coment"];

//valido os emails
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email_from)){

echo "<center>Digite um email valido</center>";
echo "<center><a href=\"java script:history.go(-1)\"><center>Voltar</center></a>";
exit;

}

//se não tiver anexo
else{

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: \"$nome\" <$email_from>\r\n";

//envia o email sem anexo
mailto:[email protected]($empresa,$resp,$contacto,$email_form,$select_tamanho,$select_tipo,$select_local,$select_tempo,$coment);

echo"Email enviado com Sucesso!"; 

}

?>

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

já resolvi isso mas agora me dá um erro, diz k so posso ter no maximo 5 parametros e eu tenho 10. tenho k criar headrs ne?

me da uma dika pf, nunca criei

<?php

//pego os dados enviados pelo formulario
$to  = "[email protected]" . ", ";

$empresa = $_POST["empresa"];
$resp = $_POST["resp"];
$contacto = $_POST["contacto"];
$email_form = $_POST["email_form"];
$select_tamanho = $_POST["select_tamanho"];
$select_tipo = $_POST["select_tipo"];
$select_local = $_POST["select_local"];
$select_tempo = $_POST["select_tempo"];
$coment = $_POST["coment"];

//valido os emails
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email_form)){

echo "<center>Digite um email valido</center>";
echo "<center><a href=\"java script:history.go(-1)\"><center>Voltar</center></a>";
exit;

}

//se não tiver anexo
else{

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: \"$nome\" <$email_from>\r\n";

//envia o email sem anexo
mail( $to, $empresa, $resp, $contacto, $email_form, $select_tamanho, $select_tipo, $select_local, $select_tempo, $coment);

echo"Email enviado com Sucesso!"; 

}

?>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  



  • Forum Statistics

    • Total Topics
      148578
    • Total Posts
      644284
×
×
  • Create New...