PHP foreach echo将“符号”打印为值

I fetched data dynamically from from MySQL using a drop down menu through Ajax which was successful but when I echo the array values, instead of giving me the list of emails it was showing just symbols.

Take a look at the image below: enter image description here

From the Email List, those are the symbols that were echo out.

here is my php code

if(isset($_POST["confirm_no"])){

    $d = $_POST['confirm_no'];
    $query = mysqli_query($mysqli, "select * from jobseeker WHERE confirm_no LIKE  '$d%'");

    //Display  list
    if(mysqli_num_rows($query) > 0){
          $row = mysqli_fetch_array($query);
            foreach ($row as $r) {
            $emailArr[] = $r["mails"];
        }
         $emails = implode(";", $emailArr);

        echo $emails;

    }else{
        echo 'No email for this selection.';
    }
}

And the jQuery

$(document).ready(function(){ 

$('#smode').change(function(){
var confirm_no = $(this).val();
$.ajax({
   type:'POST',
  data:"confirm_no="+confirm_no,
   url:'get_email.php',
   success:function(data){
       $('#emaillist').val(data);
   } 

});
});
});

Why is it echoing out this symbols?

Rebuild your code as:

//Display  list
if(mysqli_num_rows($query) > 0){
    // You have many results - fetch them all iteratively
    // use `fetch_assoc` to have ability to use `mails`
    while ($row = mysqli_fetch_assoc($query)) {
        $emailArr[] = $row["mails"];
    }
    $emails = implode(";", $emailArr);

    echo $emails;
}else{
    echo 'No email for this selection.';
}

You are fetching the data incorrectly, you only fetch the one row (the call to mysqli_fetch_array()

$row = mysqli_fetch_array($query);
foreach ($row as $r) {
    $emailArr[] = $r["mails"];
}

Could be better written as

while( $row = mysqli_fetch_assoc($query)) {
    $emailArr[] = $row["mails"];
}

Or...

$emailArr = mysqli_fetch_all($query, MYSQLI_ASSOC);
$emailArr = array_column($emailArr, "mails");