Hello all,

I am a newby at PHP and am trying to get a simple php form to work for my friends site. I have posted here in the past in regards to this form and have progressed quite a lot thanks to lots of hard work and lots of help from you guys but I am still having troubles.

I need some advice on character encoding as when the email sends an special charaters such as and the are received scrambled.

my code is as follows:


<link rel="Shortcut Icon" href="favicon.ico"/>

<link href="style2.css" rel="stylesheet" type="text/css"/>



    $send = true;
    $email = 'info@elisegur.es';
    $contactname = $_POST['contactname'];
    $detalles = $_POST['detalles'];
    $emaild = $_POST['emaild'];
    $telephone = $_POST['telephone'];
    $tipo = $_POST['tipo'];

echo "<p>Gracias por su consulta".".</p>";

    if($send != false) {
    mail($email, $contactname, $telephone, $emaild);
    mail($email, $contactname, $detalles, $tipo);
      echo "<h4>Su mensaje ha sido enviado. En breve nos pondremos en contacto con usted</h4>";
    } else {
      echo "<h4>No se ha realizado el envio de informaciones a $email</h4>";
echo "<a href='javascript:history.back(1);'>Atras</a>";

I have checked the following link http://www.sitepoint.com/forums/showthread.php?t=612567 (which was useful) and tried to google for answers (but most of the answers were just too technical for me) but I still cant get it to work!

I have added: header

('Content-type: text/html; charset=utf-8');

and tried to add

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

to the top of the page but it didnt seem to do anything.I also tried

mb_detect_encoding($html, "ascii, cp1252, iso-8859-1, utf-8")

but that just showed a blank page when it tried to process and now have completely ran out of ideas. If anyone can give me a little advice or just some pointers it would be much appreciated.

ps. I know I have programmed the code to send 2 emails. I have done this as individually every declaration (I am not sure I am using the right term) works individually but when I send them all together it just does not send the email. This is a secondary concern for me at the moment, I just need to get the character encoding working.