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@email.com";
$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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