title: choose right text direction depending on input
body: <p>I'm trying to build a webpage where two types of users come to my web site. One is the usual English users, and the second one is Persian users ( same text attributes as Arabic, like text direction and text alignment ). So I want to be able to set the text direction of echoed texts depending on users input.</p>
  
  <p>Let me give you an example ;</p>
  
  <p>I have a text input like this :</p>
  
  <pre><code>&lt;form name="myform" action="thispage.php" method="post" target="_self"&gt;
  &lt;input type="text" id="decsription" name="description" value="" /&gt;
  &lt;input type="submit" name="submit" value="SUBMIT" &gt;
  &lt;/form&gt;
  
  &lt;?php 
  
  if (isset($_POST['description']))
  {
  echo '&lt;div align="right" dir="rtl"&gt; Your Chiose is : '.$_POST['description'].'&lt;/div&gt;';
  }
  </code></pre>
  
  <p>SO, for example if the text input is typed in english, the echo section would change to something like this :</p>
  
  <pre><code>echo '&lt;div align="left" dir="ltr"&gt; Your Chiose is : '.$_POST['description'].'&lt;/div&gt;';
  </code></pre>
  
  <p>But if the text is non English, then the echo section would be like this :</p>
  
  <pre><code>echo '&lt;div align="right" dir="rtl"&gt; انتخاب شما : '.$_POST['description'].'&lt;/div&gt;';
  </code></pre>
  
  <p>Is this possible to do ?</p>
  
  <p>Thanks for your help.</p>