2016-11-02 2 views
1

enter image description here아랍어 텍스트가없는 텍스트 상자

직원 번호 텍스트 상자 또는 이름에 입력의 기준으로 검색 직원 아래의 코드에서 검색하지만 아랍어에서 이름을 가지고 있고 그것은 일치하지 않습니다. 이미지 broser에 priperly 아랍어 보여주는 연결되어 있지만

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <html> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
     <title>Search Contacts</title> 
     <link rel="stylesheet" href="css/insert.css" /> 
     <link rel="stylesheet" href="css/navcss.css" /> 
     </head> 
     <body> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     <div class="maindiv"> 
<?php include("includes/head.php");?> 
<?php include("menu.php");?> 

     <!--HTML form --> 
      <div class="form_div"> 
     <h3>Search Records:</h3> 
     <p>You may search by Employee Number</p> 
     <form method="post" action="search.php?go" id="searchform"> 
      <input type="text" class="input" name="emp_number"> 
      <input type="submit" class="input" name="submit" value="Search"> 
     </form> 

<?php 

include 'connect-db.php'; 
    //do something here in code 

     if(isset($_POST['submit'])){ 
     if(isset($_GET['go'])){ 
     if(preg_match("/^[a-zA-Z0-9,]+$/", $_POST['emp_number'])){ 
     //if(preg_match("/\p{Arabic}/u", $_POST['first_name'])){ 
     $emp_number=$_POST['emp_number']; 
     //$first_name=$_POST['first_name']; 
     //connect to the database 
     //$db=mysql_connect ("localhost", "root", "") or die ('I cannot connect to the database because: ' . mysql_error()); 
     //-select the database to use 
     //$mydb=mysql_select_db("mydb"); 
     //-query the database table 
     //mysqli_query($connection,"SET CHARACTER SET utf8"); 
     $sql="SELECT * FROM employees WHERE emp_number LIKE '%" . $emp_number . "%' OR first_name LIKE '%" . $emp_number."%'"; 
     //-run the query against the mysql query function . $name . 
     $result=mysql_query($sql); 
     //-create while loop and loop through result set 
     while($row=mysql_fetch_array($result)){ 
       $FirstName =$row['first_name']; 

     echo "<table border='1' cellpadding='10'>"; 
     echo "<tr><th>First Name</th> <th>Last Name</th><th>Employee Number</th><th>Department</th><th>Email</th><th>Total Printers</th><th>Total Scanners</th><th>Total PCs</th><th>Total Telephones</th></tr>";   

     //-display the result of the array 
     echo "<tr>"; 
     echo '<td>' . $row['first_name'] . '</td>'; 
     echo '<td>' . $row['last_name'] . '</td>'; 
     echo '<td>' . $row['emp_number'] . '</td>'; 
     echo '<td>' . $row['department'] . '</td>'; 
     echo '<td>' . $row['email'] . '</td>'; 
     echo '<td>' . $row['total_printers'] . '</td>'; 
     echo '<td>' . $row['total_scanners'] . '</td>'; 
     echo '<td>' . $row['total_pc'] . '</td>'; 
     echo '<td>' . $row['total_phones'] . '</td>'; 
     echo '<td class="forscreen"><a href="view-one.php?emp_id=' . $row['emp_id'] . '">View</a></td>'; 
     echo '<td class="forscreen"><a href="edit.php?emp_id=' . $row['emp_id'] . '">Edit</a></td>'; 
     echo '<td class="forscreen"><a href="delete4msearch.php?emp_id=' .$row['emp_id'] . '">Delete</a></td>'; 
     echo '<td class="forscreen"><a href="view-aceessory.php?emp_number=' .$row['emp_number'] . '">View Accessories</a></td>'; 
     echo '<td class="forscreen"><a href="equipments.php?emp_number=' .$row['emp_number'] . '">Add Accessories</a></td>'; 
     //echo '<button class="btnPrint" type="submit" value="Submit" onclick="window.print()">Print</button>'; 
     //echo '<button class="btnPrevious" type="submit" value="Submit" onclick="history.back(); return false;">Return to previous page</button>'; 


     /*echo "<ul>\n"; 
     echo "<li>" . "<a href=\"search.php?first_name=$FirstName\">" .$FirstName . "</a></li>\n"; 
     echo "</ul>"; */ 
     echo "</tr>"; 

     } 
     // close table> 

echo "</table>"; 

     } 
     else{ 
     echo "<p>Please enter a search query</p>"; 
     } 
     } 

     } 


    ?> 

    <div class="forscreen"> 
    <br /> 

<button class="btnPrint" type="submit" value="Submit" onclick="window.print()">Print</button> 
<button class="btnPrevious" type="submit" value="Submit" onclick="history.back(); return false;">Return to previous page</button> 

</div> 


</div> 
</div> 
     </body> 
    </html> 

답변

0

데이터베이스 테이블의 기본 데이터 정렬을 확인해야합니다. 나는 종종 한국인 charachters와 일하고 나는 항상 모든 것이 설정되어 있는지 확인합니다. (HTML/PHP 헤더 및 DB 테이블 정렬).

+0

예 모두가 전체 테이블에 utf-8로 설정되어 있습니다. –

0

이것은 PHP의 현대 버전에서 요구되지 않는 이유를 알고 내가 그나마 텍스트 상자가 검색됩니다 아니지만, 파일의 첫 번째 행에서 추가 다음 :

<?php 
    header('Content-Type: text/html; charset=utf-8'); 
    mb_internal_encoding('UTF-8'); 
    mb_http_output('UTF-8'); 
?> 
+0

작동하지 않습니다 .. 아무것도 표시되지 않습니다 .. –