Jump to content

PHP mail form in arabic


dhanesh

Recommended Posts

Hello all,

 

Just started learning a bit of PHP from resources i can find over the net. I am working on a mail form and it works perfectly with the english text. no errors or issues. But when i type in arabic my outlook receives it as :

 

ÙØ§Øª ثيات سثسقغتن غتن  ÙØºØ«ØªÙ† ثغ ثغن ØµÙ ÙŠÙØºÙ† ÙØº Ù† ØµÙØºÙ†  ثعغ ØµØªÙ†ÙØºØª ØµÙ†Ø«ÙØ¹

 

Could anyone point out where my problem is please ?

 

Thanks in advance and appreciate yoru help guys.

Cheers.

 

HTML - test.html

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form</title>
<link href="style_form.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form id="form1" name="form1" method="post" action="test.php">
<table width="830" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td height="78" colspan="2" valign="top" background="images/fheader.jpg"><p> </p>
      <p> </p></td>
    </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid; border-top: 8px white solid;"><strong>Name: *</strong></td>
    <td style="border-bottom: 2px white solid; border-top: 8px white solid;"><textarea name="name" cols="58" rows="1" id="name"></textarea></td>
  </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Occupation: *</strong></td>
    <td style="border-bottom: 2px white solid;"><textarea name="occupation" id="occupation" cols="58" rows="1"></textarea></td>
  </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Nationality: *</strong></td>
    <td style="border-bottom: 2px white solid;"><textarea name="nationality" cols="58" rows="1" id="nationality"></textarea></td>
  </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Country of residence: *</strong></td>
    <td style="border-bottom: 2px white solid;"><textarea name="country" id="country" cols="58" rows="1"></textarea></td>
  </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Telephone number: *</strong></td>
    <td style="border-bottom: 2px white solid;"><textarea name="telephone" id="telephone" cols="58" rows="1"></textarea></td>
  </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Email address: *</strong></td>
    <td style="border-bottom: 2px white solid;"><textarea name="email" id="email" cols="58" rows="1"></textarea></td>
  </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Comments:</strong> *</td>
    <td style="border-bottom: 2px white solid;"><textarea name="j" id="j" cols="58" rows="4"></textarea></td>
  </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Comments about us: *</strong></td>
    <td style="border-bottom: 2px white solid;"><textarea name="jd" id="jd" cols="58" rows="4"></textarea></td>
  </tr>
  
  <tr >
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Comments about the website: *</strong></td>
    <td style="border-bottom: 2px white solid;"><textarea name="website" id="website" cols="58" rows="4"></textarea></td>
  </tr>
  
  <tr>
    <td width="300" valign="top" style="border-bottom: 2px white solid;"><strong>Other information you wish to provide:</strong></td>
    <td style="border-bottom: 2px white solid;"><textarea name="other" id="other" cols="58" rows="4"></textarea></td>
  </tr>
   
  <tr>
    <td valign="top"> </td>
    <td><input type="submit" name="Submit" id="Submit" value="Submit" />
      <input type="submit" name="Reset" id="Reset" value="Reset" /></td>
  </tr>
</table>
</form>

</body>
</html>

 

 

PHP - test.php

 

<?php

if(isset($_POST['Submit'])) {

$to = "[email protected]";
$subject = "Feedback [Arabic]";
$name_field = $_POST['name'];
$occupation_field = $_POST['occupation'];
$nationality_field = $_POST['nationality'];
$country_field = $_POST['country'];
$telephone_field = $_POST['telephone'];
$email_field = $_POST['email'];
$j_field = $_POST['j'];
$jd_field = $_POST['jd'];
$website_field = $_POST['website'];
$other_field = $_POST['other'];

$headers  = "MIME-Version: 1.0 \n" ;

$headers .= "Content-Type: text/plain;charset=UTF-8 \n";

$body = mb_convert_encoding($body, "UTF-8","AUTO");

mb_language("uni");


$body = "Name: $name_field\n\n Occupation: $occupation_field\n\n Nationality: $nationality_field\n\n Country of residence: $country_field\n\n Telephone: $telephone_field\n\n Email: $email_field\n\n Comments: $j_field\n\n Comments about us: $jd_field\n\n Comments about website: $website_field\n\n Other information: $other_field\n\n"; 

mb_send_mail($to, $subject, $body);

} else {

echo  "error: no data sent!";

}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<title>Sending...</title>
<meta http-equiv="refresh" content="1;url=fthankyou_ar.html">
<meta http-equi
</head>
<div align="center">
  <p><img src="/images/loadbar.gif" width="232" height="11"></p>
  <p><b>Prcessing and redirecting ...</b></p>
</div>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/211684-php-mail-form-in-arabic/
Share on other sites

 

arabic way...

 

example short

<html dir="rtl">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <head>
    </head>
<body> Submitted </body>
</html>

 

read the header section mate

 

http://php.net/manual/en/function.mail.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.