Jump to content

Post Arabic Form


cosmoasif

Recommended Posts

I have created a Post php form, It send two emails, One email to the user after they submit the form and other to me. Now the users will fill up the form in arabic and a confirmation email will be sent to them in arabic also...I tested my form, I get the confirmation email in arabic, its fine, but the data tht the user inputs in arabic on the form comes to my email with strange characters.....i want to receive the data entered by user in arabic. Below is the HTML and Php

 

Here is my HTML

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

body {
background-color: #FFFFFF;
}

.style8 {color: #FF0000}
-->
</style>

<script src="../../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="../../SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<link href="../../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="../../SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table align="center" width="547" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
  </tr>
</table>

<form method="post" name="enquiry" action="sendmailsqlar.php">
<table width="547"  align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="101" background="../../images/formhead.png"><div align="center" class="status" style="margin-bottom:20px; margin-top:20px">نموذج الاستفسار عن الدورة الأكاديمية</div></td>
  </tr>
</table>


<table width="547" border="0" align="center" cellspacing="0" cellpadding="0">
  <tr>
    <td width="275"><div align="right"><input name="Name" type="text" id="visitor" value="" size="36" class="field"   /></div></td>
    <td width="272" align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;">
      <div style="margin-right:25px;">الاسم</div>
      <span id="sprytextfield1"><span class="textfieldRequiredMsg">مطلوب</span></span></div></td>
  </tr>
  <tr>
    <td><div align="right"><input name="Email" type="text" id="visitormail" size="36" class="field" /></div></td>
    <td align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;">
      <div style="margin-right:25px;">البريد الإلكتروني</div>
      <span id="sprytextfield2"><span class="textfieldRequiredMsg">مطلوب</span><span class="textfieldInvalidFormatMsg">غير صحيح </span></span></div></td>
  </tr>
  <tr>
    <td><div align="right"><input name="Nationality" type="text" id="nationality" size="36" class="field" /></div></td>
    <td align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;">
      <div style="margin-right:25px;">الجنسية</div>
      <span id="sprytextfield2"><span class="textfieldRequiredMsg">مطلوب</span></span></div></td>
  </tr>
  
  <tr>
    <td align=""><div align="right">
      <select name="Level" id="stulevel" size="1" class="select">
        <option value=""><span class="drop.Text">(إختر)</span></option>
        <option value=" Foundation/Diploma ">دبلوم</option>
        <option value=" Bachelor Degree ">البكالوريوس</option>
        <option value=" Master Degree ">ماجستير</option>
        <option value=" PhD./Others ">دكتوراه</option>
      </select>
    </span></div></td>
    <td align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;">
      <div style="margin-right:25px;">المرحلة الدراسية المطلوبه</div>
      <span id="spryselect1"><span class="selectRequiredMsg">مطلوب</span></span></div></td>
  </tr>
  <tr>
    <td><div align="right"><input name="Field" type="text" id="stfield" size="36" class="field"  /></div> </td>
    <td align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;">
      <div style="margin-right:25px;">مجال الدراسة \ التخصص</div>
      <span id="sprytextfield3"><span class="textfieldRequiredMsg">مطلوب</span></span></div></td>
  </tr>
  <tr>
    <td colspan="2"><table width="547" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="275"><label>
          <div align="right"><textarea name="Message" style="background-color:#ccc2b2" class="field" id="message" cols="27" rows="6"></textarea></div>
          </label></td>
        <td width="272" align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;">
          <div style="margin-right:25px;">ملاحظات</div>
          </div></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td colspan="2" height="101" background="../../images/formfoot.png"><div align="center" style="margin-top:15px">
      <input type="submit" class="btn1"  value="إرسال" />
    </div></td>
    </tr>

</table>
</form>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
//-->
</script>
</body>
</html>

 

Here is the PHP

 

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

<?php 
$to = "xx@xxx.com";
$visitor = $_REQUEST['Name'] ;
$visitormail = $_REQUEST['Email'] ;
$nationality = $_REQUEST['Nationality'] ;
$stulevel = $_REQUEST['Level'] ;
$stfield = $_REQUEST['Field'] ;
$message = $_REQUEST['Message'] ;
$header = "From: $visitormail\n"
  . "Reply-To: $visitormail\n";
$subject = "Arab Enquiry";
$message = "From: $visitor \n\n Email: $visitormail \n\n Nationality: $nationality \n\n Level: $stulevel \n\n Field: $stfield \n\n Message: $message";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $message, $header);

//Sending auto respond Email to visitor
$reply_header = "From: ttt@ttt.com\n"
  . "Reply-To: vvv@vvv.com\n";
$reply_subject = " - تم استلام طلبكم";
$reply_to = "$visitormail";
$reply_message = "$visitor \n\n شكرا لزيارتكم موقعنا . \n نود ابلاغكم بأنه تم استلام طلبكم وسوف يتم الرد عليكم قريبا.\n هذه الرسالة مرسلة من نظام الموقع.\n شكرا\n .";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($reply_to, $reply_subject, $reply_message, $reply_header);

header("Location: thankyouar.html");

?>

please help !!!! i would appreciate

 

Link to comment
Share on other sites

thank you moderator...i searched some more and got it working had to add these

 

$headers .= 'Content-type: text/plain; charset=UTF-8; format=flowed' . "\r\n";

$headers .= 'Content-Transfer-Encoding: 8bit'."\r\n"; 

 

mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header, $headers);

 

'=?UTF-8?B?'.base64_encode($subject).'?='    - this must be added like i added it up

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.