lundi 3 juin 2019

Why .includes always return false even if the answer is true?

I would like to check for the expertise of the professionals but my .includes always return false.

This is the code before my function to check the expertise:

<?php
if (isset($_GET['id'])) {

    $id = $_GET['id'];
    $sql = "SELECT * FROM professional, job, location WHERE PROFESSIONAL_ID LIKE '%$id%' AND PROFESSIONAL_ID=JOB_ID AND JOB_ID = LOCATION_ID " ;
    $result = mysqli_query($conn, $sql);

    $row = mysqli_fetch_assoc($result);
    $new_result = $row["JOB_NAME"];



    echo "
                <div class='card'>
                <img src='../images/img.png' style='width:100%'>
                <h2>".$row['PROFESSIONAL_NAME']."</h2>
                <p class='title'><i class='fa fa-briefcase' aria-hidden='true'></i> ".$row['JOB_NAME']."</p>
                <p class='marker'><i class='fa fa-map-marker' aria-hidden='true'></i> ".$row['LOCATION_NAME']."</p>
                <a href=".$row['PROFESSIONAL_URL']."><p><button>Contact</button></p></a>
              </div>  
              <div class='network'> 
  <h2> Filter Network</h2>
  </div>
  <div class='filter'>
        <input type='radio' id='1' value='$new_result' unchecked name='radioBtn' onclick='if(this.checked){myFunction()}'> <label> Expertise</label><br>
        <input type='radio' value='Location' unchecked name='radioBtn' onclick='CheckLocation($new_result)'> <label> Location</label><br>
        <input type='radio' value='Workplace' unchecked name='radioBtn' onclick='CheckWorkplace($new_result)'> <label> Workplace </label><br>
        <input type='radio' value='Past Workplace' unchecked name='radioBtn' onclick='CheckPast($new_result)'> <label>Past Workplace</label><br>
        </div>
                ";    


}
?>

And this is where I check for the expertise:

<script>
function myFunction() {
      var expert = document.getElementById("1").value;
       var n = expert.includes('data analyst');

                 alert (n);
    }
  </script>




Aucun commentaire:

Enregistrer un commentaire