[ For those of you who are going to get pissed for top-posting, find
something better to bitch about.  I'm in a rush, but trying to help.
;-P ]

   Luc,

   You're not defining $contato_name.

   Do this:
       $contato_name = $_POST['contato_name'];

On 7/24/07, Luc <[EMAIL PROTECTED]> wrote:
 Good afternoon list,

 Probably a no-brainer for the most of you but i'm in a pickle: i've
 set up a variable to receive in the body of the notification mail
 upon sending a form.

 The body of the mail should read like this:

 Obrigado por nos contatar, $contato_name. Recebemos sua mensagem e entraremos 
em contato em breve.

 (in english: tnx for contacting us, $contato_name. We received your
 message and will contact you shortly.)

 Where $contato_name is the name of the contact, as used in the form.

 The problem is that the message arrives without the $contato_name, so
 i get: Obrigado por nos contatar,  . Recebemos sua mensagem e entraremos em 
contato em breve.

 Here's the script:

<?
    // set your own preferences here
#############################################################
// Your email address
$youremail =   ;
// Your web site title (John Doe's Site)
$websitetitle =   ;
// Path to "thanks for the message" page
$thankyoupage =  ' ';
// Send notification to sender (use false if not required)
$sendnotification = true;
   // Continue with your error checking, output of form, et cetera.
$contact_form_action = $_SERVER['PHP_SELF'];
if ((isset($_POST["sendcontact"])) && ($_POST["sendcontact"] == "contactsent")) 
{
        $contacter_form_error = array();
        if (empty($_POST['empresa_name'])){
                $contacter_form_error[] = 'favor preencher nome da empresa';
        }
        if (empty($_POST['contato_name'])){
                $contacter_form_error[] = 'favor preencher nome do contato';
        }
        if (empty($_POST['fone'])){
                $contacter_form_error[] = 'favor preencher número do telefone';
        }
        if (empty($_POST['contato_email'])){
                $contacter_form_error[] = 'favor preencher seu e-mail';
        }
        if (empty($_POST['produto'])){
                $contacter_form_error[] = 'favor preencher o produto';
        }
        if (empty($_POST['origem'])){
                $contacter_form_error[] = 'favor preencher origem';
        }
        if (empty($_POST['destino'])){
                $contacter_form_error[] = 'favor preencher destino';
        }
        if (empty($_POST['quantidade'])){
                $contacter_form_error[] = 'favor preencher quantidade';
        }
        if (empty($_POST['peso'])){
                $contacter_form_error[] = 'favor preencher peso';
        }
        if (empty($_POST['comprimento'])){
                $contacter_form_error[] = 'favor preencher comprimento';
        }
        if (empty($_POST['altura'])){
                $contacter_form_error[] = 'favor preencher altura';
        }
        if (empty($_POST['largura'])){
                $contacter_form_error[] = 'favor preencher largura';
        }
        else {
                $empresa_name = stripslashes($_POST['empresa_name']);
                $contato_email = stripslashes($_POST['contato_email']);

    $body =<<<EOB
Empresa: $_POST[empresa_name]
Contato: $_POST[contato_name]
Fone: $_POST[fone]
Fax: $_POST[fax]
Email: $_POST[contato_email]
Produto: $_POST[produto]
Origem: $_POST[origem]
Destino: $_POST[destino]
Quantidade: $_POST[quantidade]
Peso: $_POST[peso]
Comprimento: $_POST[comprimento]
Altura: $_POST[altura]
Largura: $_POST[largura]
EOB;
                $subjectline = "$websitetitle | Orçamento de empresa";
                $notification_message = "Obrigado por nos contatar, $contato_name. 
Recebemos sua mensagem e entraremos em contato em breve.";
                $notification_subject = "Obrigado por sua mensagem para 
$websitetitle.";
                mail($contato_email,$subjectline,$body, "From: $contato_email");
                mail($contato_email, $notification_subject, $notification_message, 
"From: $youremail");
                header("Location:$thankyoupage");
        }
}
?>
// Print form field errors if present
if (count($contacter_form_error)>0){
        print '<p id="bottom"><strong>Algo está errado:</strong></p>'."\n";
        print '<ul>'."\n";
        foreach($contacter_form_error as $form_err) {
                print "<li class=\"error\">$form_err</li>\n";
        }
        print '</ul>'."\n";
}
?>
<form method="post" id="contactform" action="<? print $contact_form_action; ?>">
<p>Todos os campos obrigatórios são marcados com asteriscos (<span 
class="required">*</span>).</p>
<fieldset>
<legend>Seus Dados</legend>
<label for="empresa_name">Empresa <span class="required">*</span></label>
<br />
<input type="text" id="empresa_name" name="empresa_name" size="30" value="<? print 
$empresa_name; ?>" />
<br />
<label for="contato_name">Contato <span class="required">*</span></label>
<br />
<input type="text" id="contato_name" name="contato_name" size="30" value="<? print 
$contato_name; ?>" />
<br />
<label for="fone">Número do telefone <span class="required">*</span></label>
<br />
<input type="text" id="fone" name="fone" size="30" value="<? print $fone; ?>" />
<br />
<label for="fax">Fax</label>
<br />
<input type="text" id="fax" name="fax" size="30" value="<? print $fax; ?>" />
<br />
<label for="contato_email">E-mail <span class="required">*</span></label>
<br />
<input type="text" id="contato_email" name="contato_email" size="30" value="<? print 
$contato_email; ?>" />
<br />
<label for="produto">Produto <span class="required">*</span></label>
<br />
<input type="text" id="produto" name="produto" size="30" value="<? print $produto; 
?>" />
<br />
<label for="origem">Origem <span class="required">*</span></label>
<br />
<input type="text" id="origem" name="origem" size="30" value="<? print $origem ?>" 
/>
<br />
<label for="destino">Destino <span class="required">*</span></label>
<br />
<input type="text" id="destino" name="destino" size="30" value="<? print $destino; 
?>" />
<br />
<label for="quantidade">Quantidade <span class="required">*</span></label>
<br />
<input type="text" id="quantidade" name="quantidade" size="30" value="<? print 
$quantidade; ?>" />
<br />
<label for="peso">Peso <span class="required">*</span></label>
<br />
<input type="text" id="peso" name="peso" size="30" value="<? print $peso; ?>" />
<br />
<label for="comprimento">Comprimento <span class="required">*</span></label>
<br />
<input type="text" id="comprimento" name="comprimento" size="30" value="<? print 
$comprimento; ?>" />
<br />
<label for="altura">Altura <span class="required">*</span></label>
<br />
<input type="text" id="altura" name="altura" size="30" value="<? print $altura; 
?>" />
<br />
<label for="largura">Largura <span class="required">*</span></label>
<br />
<input type="text" id="largura" name="largura" size="30" value="<? print $largura; 
?>" />
<br />
</fieldset>
<input type="hidden" name="sendcontact" value="contactsent" />
<input type="submit" value="Enviar" />
</form>

--
Best regards,
 Luc
________________________


Powered by The Bat! version 3.99.3 with Windows XP (build 2600),
version 5.1 Service Pack 2 and using the best browser: Opera.

"If you feel Dog tired at night, it may be because you growled all
day!"

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to