2

Hi I am trying to submit arabic data to mysql using forms I ve already sat up all the columns of tables that should be in arabic to u8_general_ci when I save data through phpmyadmin it's well saved and retrieved well but when I submit it through form the data saved as question marks "?????" although I used all of theses

        <form  action="" method="post" accept-charset="utf-8" >
header("Content-Type: text/html;charset=UTF-8");

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

what could be the solution thanks in advance :)

Ali M Safi
  • 35
  • 1
  • 7
  • This page has some great pointers: http://www.phptherightway.com/#i18n_l10n – Benny Hill Jun 18 '17 at 04:22
  • See "question marks" in http://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored . It discusses the likely causes and general Best Practices. – Rick James Jun 29 '17 at 23:10

2 Answers2

0

Make sure to set the connection character set, run the following:

//PDO example
$dbh->exec('SET CHARACTER SET utf8');
wesamly
  • 1,484
  • 1
  • 16
  • 23
-1

Use the HTML5 pattern attribute.

Use this for Arabic : pattern=[أ-يa-zA-Z]

Example:

<input type="text" name="fname" pattern=[أ-يa-zA-Z] placeholder="Type your name">

Haris Papadakis
  • 89
  • 1
  • 2
  • 13