Jump to content

Onzeon

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Onzeon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello PHP GURUS. I have this PHP code for my HTML email form. This site is in Brazil, so most people requesting information and using the form write in portuguese using the language characters. (ã, é, ó, ç, í and others). When I get the response back, all the special characters are replaced by different characters (like they are not available in the font family) like this: Gostaria de uma informação de vocês. What we get is: Gostaria de uma informação de vocês. (in the courier font) We dont know if it is the font family or the server that is eliminating/replacing the characters. Is there a way to force these characters by specifying a font-family in the PHP code for the body of the email? Thank you very much for taking the time to even read this. Here is my code: <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "myemail@me.com"; $email_subject = "Pedido para contato"; function died($error) { // your error code can go here echo "Lamentamos muito, mas houve erro(s) encontrado com a forma que voce enviou. "; echo "Esses erros aparecem abaixo.<br /><br />"; echo $error."<br /><br />"; echo "Por favor, volte para corrigir esses erros.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['last_name']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['comments'])) { died('Lamentamos, mas parece haver um problema com a forma que voce enviou.'); } $first_name = $_POST['first_name']; // required $last_name = $_POST['last_name']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= '- O endereco de e-mail que voce digitou nao parece ser valido.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= '- O nome que voce digitou nao parece ser valido.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= '- O Sobre Nome que voce digitou nao parece ser valido.<br />'; } if(strlen($comments) < 2) { $error_message .= '- O pedido de informacao que voce digitou nao parece ser valido.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Detalhes da forma a baixo.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Nome: ".clean_string($first_name)."\n"; $email_message .= "Sobre Nome: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telefone: ".clean_string($telephone)."\n"; $email_message .= "Informacao pedida: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> success <?php } ?>
  2. Thank you for your quick reply: Here is the HTML form: <form action="send_contact.php" method="post" enctype="multipart/form-data" id="ContactForm"> <div class="container"> <div class="col-1"> <label> <strong>Name:</strong><br /> <input type="text" name="name" id="name" class="input" /> </label> <label> <strong>Subject:</strong><br /> <input type="text" name="subject" id="subject" class="input" /> </label> <label> <strong>E-mail:</strong><br /> <input type="text" name="email" id="customer_mail" class="input" /> </label> <label> <strong>Telephone:</strong><br /> <input type="text" name="telephone" id="telephone" class="input" /> </label> </div> <div class="col-2"> <strong>Write your details here.</strong><br /> <textarea name="detail" cols="10" rows="10" id="detail"></textarea> </div> </div> <div class="container"> <div class="right"> <a href="#" class="link" onclick="document.getElementById('ContactForm').reset()"><span><span>Limpar</span></span></a> <a href="#" class="link" onclick="document.getElementById('ContactForm').submit()"><span><span>Enviar</span></span></a> </div> </div> </form> AND HERE IS MY 1st LAME ATTEMPT AT A PHP Script. <?php // Enter your email address $to ='onzeon@me.com'; // Name $name = $_POST['name']; // Details $message = $_POST['message']; // Mail of sender $email = $_POST['email']; $body = "$name "sent you a message": $message"; $send_contact=mail($to,$subject,$detail,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We received you email, Thank you"; } else { echo "ERROR"; } ?> SO I GAVE UP ON THAT ONE AND MY 2nd LAME ATTEMPT AT A PHP Script. <?php // Contact subject $subject ="$assunto"; // Details $message="$detail"; // Name $name="$name"; // Mail of sender $mail_from="$customer_mail"; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='nuamces@nuamces.com.br'; $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We received you email, Thank you"; } else { echo "ERROR"; } ?> ANY HELP IS APPRECIATED>
  3. I've been at this for days, and the more I read the more confusing it gets. What I want to achieve is: I have a XHTML form with 5 user input fields - These are: name subject cust_email telephone details I need to create a PHP script that will on user click - submit a email that has this format (secured if possible: From= cust_email Subject= "Customer requested information on" +subject eMail body= name + "requests information on" + subject /n + details /n + "Contact information" /n +telephone +email. So the body would look some how like this: Jane Smith requests information on Botox Hello I'm interested in botox injections please contact me with pricing and availability. Thank you. Contact information. (888)555-1212 Jsmith@hotmail.com Can you or anyone of the users in this wonderful forum HELP. I'm a print designer and I can assist you guys with anything you may need in print. But web is all to new and I'm struggling. Thank you, thank you very much.
  4. Maybe I'm going about this the wrong way, I should ask you PHP gurus a tutorial on how to build the script I'm trying to build. I've been at this for days, and the more I read the more confusing it gets. What I want to achieve is: I have a XHTML form with 5 user input fields - These are: name subject cust_email telephone details I need to create a PHP script that will on user click - submit a email that has this format: From= cust_email Subject= "Customer requested information on" +subject eMail body= name + "requests information on" + subject /n + details /n + "Contact information" /n +telephone +email. So the body would look some how like this: Jane Smith requests information on Botox Hello I'm interested in botox injections please contact me with pricing and availability. Thank you. Contact information. (888)555-1212 Jsmith@hotmail.com Can you or anyone of the users in this wonderful forum HELP. I'm a print designer and I can assist you guys with anything you may need in print. But web is all to new and I'm struggling. Thank you, thank you very much.
  5. Thank you for your reply. (wow) I apologize if I'm not very good in the PHP lingo. I dont get any errors. It goes through, but all I get in the email is The name (where the email should be) The Subject is correct. The the body gets the details but nothing else. I want to get The email where the email should be. The subject is fine. and in the body is where I really need help. I want the have this body: Name: (the $name ID) Telephone: (the $telephone ID) Subject: (the $subject ID) I know my PHP is probably all wrong. Please help if you can, I've been trying for a while to get it right. Thank you.
  6. Hello my great PHP gurus, I have a question that might be simple for some of you geniuses. I have simple HTML email form getting sent by a PHP script and I cant get it to work right. All I want is the get the email, name, subject and in the body I need to have 3 variables ( name (again) Telephone and details. This is the code I have so far: HTML Form (relevant details only): <input type="text" name="name" id="name" class="input" /> <input type="text" name="subject" id="subject" class="input" /> <input type="text" name="email" id="customer_mail" class="input" /> <input type="text" name="telephone" id="telephone" class="input" /> <textarea name="detail" cols="10" rows="10" id="detail"></textarea> The PHP script is: <?php // Contact subject $subject ="$subject"; // Details $message="$detail"; // Name $name="$name"; // Mail of sender $mail_from="$customer_mail"; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='onzeon@me.com'; $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We received you message, thank you"; } else { echo "ERRO"; } ?> I also tried this (with no success): <?php // Contact subject $subject ="$assunto"; // Details $body = $name; $body .= "/n"; $body .= "Telephone : ".$telephone."/n"; $body .= "Subject : ".$subject."/n"; $body .= "Details : ".$details; // Name $name="$name"; // Mail of sender $mail_from="$customer_mail"; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='onzeon@me.com'; $send_contact=mail($to,$subject,$header,$body); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We received you message, thank you"; } else { echo "ERRO"; } ?> CAN ANYONE HELP, PLEASE.. Thank you very much. Cleve.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.