Re: Newbie seeks urgent help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/13/07, Daniel Brown <parasane@xxxxxxxxx> wrote:
On 7/13/07, Luc <luc@xxxxxxxxxxx> wrote:
>  Good afternoon list,
>
>  My first post here and i'm having trouble with a form: it doesn't
>  send the input to the given e-mail address: i get a blank mail
>  without any of the fields.
>
>  Here's how it should arrive in the mailbox:
>
> Empresa: field input
> Contato: field input
> Fone: field input
> Fax: field input
> Email: field input
> Produto: field input
> Origem: field input
> Destino: field input
> Quantidade: field input
> Peso: field input
> Comprimento: field input
> Altura: field input
> Largura: field input
>
>  I really appreciate the help!!!!
>
>  Here's the code and the form:
>
> // Your email address
> $youremail = 'email adress';
> // Your web site title
> $websitetitle = 'newbie.com';
> // Path to "thanks for the message" page
> $thankyoupage = 'http://www........Contact_success1.php';
> // Send notification to sender (use false if not required)
> $sendnotification = true;
> #############################################################
> // Do not edit below this
> #############################################################
> $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']);
>
>                 $subjectline = "$websitetitle | Mensagem de $empresa_name";
>
>
>                 mail($youremail, $subjectline, "Orçamento de empresa");
>                 if($sendnotification == true) {
>                         $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, $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; ?>">
> <div>
> <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="fax" id="fax" name="fax" size="30" value="<? print $fax; ?>" />
> <br />
> <label for="contato_email">E-mail <span class="required">*</span></label>
> <br />
> <input type="contato_email" 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="produto" id="produto" name="produto" size="30" value="<? print $produto; ?>" />
> <br />
> <label for="origem">Origem <span class="required">*</span></label>
> <br />
> <input type="origem" id="origem" name="origem" size="30" value="<? print $origem ?>" />
> <br />
> <label for="destino">Destino <span class="required">*</span></label>
> <br />
> <input type="destino" id="destino" name="destino" size="30" value="<? print $destino; ?>" />
> <br />
> <label for="quantidade">Quantidade <span class="required">*</span></label>
> <br />
> <input type="quantidade" id="quantidade" name="quantidade" size="30" value="<? print $quantidade; ?>" />
> <br />
> <label for="peso">Peso <span class="required">*</span></label>
> <br />
> <input type="peso" id="peso" name="peso" size="30" value="<? print $peso; ?>" />
> <br />
> <label for="comprimento">Comprimento <span class="required">*</span></label>
> <br />
> <input type="comprimento" id="comprimento" name="comprimento" size="30" value="<? print $comprimento; ?>" />
> <br />
> <label for="altura">Altura <span class="required">*</span></label>
> <br />
> <input type="altura" id="altura" name="altura" size="30" value="<? print $altura; ?>" />
> <br />
> <label for="largura">Largura <span class="required">*</span></label>
> <br />
> <input type="largura" id="largura" name="largura" size="30" value="<? print $largura; ?>" />
> <br />
> </fieldset>
> <input type="hidden" name="sendcontact" value="contactsent" />
> <input type="submit" value="Enviar" />
> </div>
> </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.
>
> "Doctor to patient: I have good news and bad news - the good news is
> that you are not a hypochondriac."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

   Luc,

   In your code, all you have is this:

   mail($youremail, $subjectline, "Orçamento de empresa");

   That instructs PHP to send an email to $youremail with the subject
$subjectline and the message "Orçamento de empresa."

   It should use a basic structure such as this....

<?
   // Your error checking and stuff goes here.
   $youremail = "me@xxxxxxxxxxxx";
   $subjectline = "Orçamento de empresa";
   $body =<<<EOB
Empresa: $_POST['empresa_name']
Contato: $_POST['contato_name']
Fone: $_POST['fone']
Fax: $_POST['fax']
Email: $_POST['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;

   $from = "me@xxxxxxxxxxxxxxxxx";
   $headers  = "From: ".$from."\r\n";
   $headers .= "X-Mailer: Dan Brown, pilotpig.net\r\n";
clandestine advertising        ^^^^  ^^^^     ^^^^^     :-P

Tijnema
--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux