Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未从文本框中搜索PHP中的阿拉伯文文本_Php_Arabic Support - Fatal编程技术网

未从文本框中搜索PHP中的阿拉伯文文本

未从文本框中搜索PHP中的阿拉伯文文本,php,arabic-support,Php,Arabic Support,下面的代码根据文本框中输入的员工编号或名字搜索员工,但我的名字是阿拉伯语,不匹配。图片附在broser上,上面显示的是珍贵的阿拉伯语,但它不是通过文本框搜索的,我不知道为什么 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <html> <meta http-equiv="Content-Type" content="text/html; charset=u

下面的代码根据文本框中输入的员工编号或名字搜索员工,但我的名字是阿拉伯语,不匹配。图片附在broser上,上面显示的是珍贵的阿拉伯语,但它不是通过文本框搜索的,我不知道为什么

<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> 

搜索联系人
搜索记录:
您可以按员工编号进行搜索


印刷品 返回上一页
现代版本的PHP可能不需要这样做,但在文件的第一行添加以下内容:

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

现代版本的PHP可能不需要这样做,但在文件的第一行添加以下内容:

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

您应该检查数据库表的默认排序规则。我经常和韩国人一起工作,我总是确保一切都设置为utf8。(HTML/PHP标题和DB表排序规则)。

您应该检查数据库表的默认排序规则。我经常和韩国人一起工作,我总是确保一切都设置为utf8。(HTML/PHP标题和DB表排序规则)