Jump to content

RuiMelo

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

RuiMelo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've just built a php email form to connect with a form inside a html page. This is the php code: <?php $html = htmlspecialchars($utf8_string, ENT_COMPAT, 'iso-8859-1'); if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = $_POST['email_to_']; $email_subject = mb_convert_encoding($_POST['subject'], 'iso-8859-1'); //$email_subject = mb_convert_encoding($content, 'UTF-8'); function died($error) { // your error code can go here echo "<script language=\"javascript\" type=\"text/javascript\"> alert('Pedimos desculpa, mas foram encontrados erros nas informacoes que submeteu. $error');window.location = \"http://animal.org.pt/email3.html\";</script>"; /*echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<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('Pedimos desculpa, mas foram encontrados erros nas informacoes que submeteu.'); } $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 .= '\n\nO Endereco de Email nao e valido!\n'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'O Nome que sumeteu nao e valido!\n'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'O Apelido que sumeteu nao e valido!\n'; } /*if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; }*/ if(strlen($error_message) > 0) { died($error_message); } //$email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= clean_string($comments); $email_message .= clean_string($first_name)." "; $email_message .= clean_string($last_name)."\n"; $email_message .= clean_string($email_from)."\n"; $email_message .= clean_string($telephone)."\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); echo "<script language=\"javascript\" type=\"text/javascript\"> alert('Obrigado pela sua mensagem!'); window.location = \"http://$_SERVER[HTTP_HOST]\"; </script> "; ?> ?> <!-- include your own success html here --> <?php } ?> This is the html code: <div class="email_form"><table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="500" class="cushycms" title="Mensagem do Email a apresentar na página"><h1>Your Message</h1><br/> <span id="messageStyle">Please adopt a policy to prevent severe animal suffering<br/> Dear [Name of University President], <br/></td> <td width="50"></td> <td width="250"><span id="formStyle"><form name="contactform" method="post" action="form1.php"> <b>Informações do contacto:</b><br><br /> Nome:<br /> <input type="text" name="first_name" size="35"><br><br> Apelido:<br /> <input type="text" name="last_name" size="35"><br><br> Email:<br> <input type="text" name="email" size="35"><br><br> Cidade:<br> <input type="text" name="telephone" size="35"><br><br> Todos os campos são obrigatórios. <br><br> <textarea id="subjct" rows="1" name="email_to_" cols="30" class="cushycms" title="Email do Destinatário">rui_melo_work@hotmail.com</textarea> <textarea id="subjct" rows="1" name="subject" cols="30" class="cushycms" title="Títulos do Email">Animal Protecção Fárú téparamekla í‏</textarea> <textarea id="textArea" rows="9" name="comments" cols="30" class="cushycms" title="Mensagem do Email enviada pelo servidor"> Please adopt a policy to prevent severe animal suffering Dear [Name of University President], I am deeply concerned that my tax dollars may be contributing to research at your institution that causes severe animal suffering. As a stakeholder in your university, I urge you to adopt a written policy prohibiting severe pain and distress in all laboratory animals in your care. Animals used in research at your institution deserve to be protected from severe suffering. Federal laws such as the Animal Welfare Act and Public Health Service Policy, as well as accreditation organizations such as the Association for Assessment and Accreditation of Laboratory Animal Care do not prohibit research or conditions that cause severe and unrelieved pain and distress. Adopting a specific policy preventing severe and unrelieved suffering is the only way to assure donors, students, alumni, faculty, staff, parents and taxpayers that animals in your care are not being subjected to severe suffering. If your school already has a policy or would like to adopt one, please contact The Humane Society of the United States at www.humanesociety.org/campuspolicycontact. Thank you for your consideration. Sincerely, </textarea> <input type="submit" value=" Enviar " name="submit"> </form></span></td> </tr> </table> </div> The problem is that the email sent by this system doen't accept paragraphs and is shown like this in the inbox of a gmail or hotmail account: <p> Please adopt a policy to prevent severe animal suffering Dear [Name of University President],</p> I am deeply concerned that my tax dollars may<br /> <br /> <br /> be contributing to research at your institution that causes severe animal suffering. As a stakeholder in your university, I urge you to adopt a written policy prohibiting severe pain and distress in all laboratory animals in your care. Animals used in research at your institution deserve to be protected from severe suffering. Federal laws such as the Animal Welfare Act and Public Health Service Policy, as well as accreditation organizations such as the Association for Assessment and Accreditation of Laboratory Animal Care do not prohibit research or conditions that cause severe and unrelieved pain and distress. Adopting a specific policy preventing severe and unrelieved suffering is the only way to assure donors, students, alumni, faculty, staff, parents and taxpayers that animals in your care are not being subjected to severe suffering. If your school already has a policy or would like to adopt one, please contact<br /> The Humane Society of the United States at www.humanesociety.org/campuspolicycontact.<br /> Thank you for your consideration.<br /> Sincerely, R I need urgent help!!! thank you
×
×
  • 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.