<?php

// Include config file
require_once "../banco/config.php";


//$dadopesquisa = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
$pescliente_id = $_GET['pesquisar'];

// Attempt select query execution
$sql = "SELECT * FROM clientes, respostas, perguntas WHERE clientes.id=respostas.cliente_id LIKE '%$pescliente_id%'";
if($result = mysqli_query($link, $sql)){
    if(mysqli_num_rows($result) > 0){
        while($row = mysqli_fetch_array($result)){

        

    ?>
<!-- Single Item -->
<div class="single-item">
                                                        <div class="item">
                                                            <div class="info">
                                                                <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "apto" name = "apto[]"  value = "Apto" <?php echo $row['apto'] == 'Apto' ? 'checked' :''; ?>><span><strong> Apto    </strong></span>
                                                                <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "apto" name = "apto[]"  value = "Não apto" <?php echo $row['apto'] == 'Não apto' ? 'checked' :''; ?>><span><strong> Não apto</strong></span>
                                                                <h3>
                                                                    <h2>Efetiva</h2>
                                                                    <h3> 1. EFICÁCIA E EFICIÊNCIA</h3>         
                                                                    <p>Conceito:  <?php echo $row['conceito'] ?>
                                                                        </p>
                                                                        <h4>Pergunta</h4>
                                                                        <h5>
                                                                        <?php echo $row['perguntas'] ?>
                                                                        </h5>
                                                                    <div>
                                                                        <h4>Escala de Nota</h4>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "0" <?php echo $row['nota'] == '0' ? 'checked' :''; ?>>  <span><strong>0</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "1" <?php echo $row['nota'] == '1' ? 'checked' :''; ?>>  <span><strong>1</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "2" <?php echo $row['nota'] == '2' ? 'checked' :''; ?>>  <span><strong>2</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "3" <?php echo $row['nota'] == '3' ? 'checked' :''; ?>>  <span><strong>3</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "4" <?php echo $row['nota'] == '4' ? 'checked' :''; ?>>  <span><strong>4</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "5" <?php echo $row['nota'] == '5' ? 'checked' :''; ?>>  <span><strong>5</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "6" <?php echo $row['nota'] == '6' ? 'checked' :''; ?>>  <span><strong>6</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "7" <?php echo $row['nota'] == '7' ? 'checked' :''; ?>>  <span><strong>7</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "8" <?php echo $row['nota'] == '8' ? 'checked' :''; ?>>  <span><strong>8</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "9" <?php echo $row['nota'] == '9' ? 'checked' :''; ?>>  <span><strong>9</strong></span>
                                                                        <input class="btn circle btn-theme border btn-sm" type= "checkbox" id = "nota" name = "nota[]"  value = "10" <?php echo $row['nota'] == '10' ? 'checked' :''; ?>>  <span><strong>10</strong></span>

                                                                        <h4>Observações</h4>
                                                                        
                                                                        <input class="form-control" type= "text" value="<?php echo $row['observacao']; ?>" id = "observacao" name = "observacao[]">

                                                                    </div> 
                                                                </h3>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <!-- End Single Item --> 
                                                    
                                                    
                                                    <?php
    
}
        // Free result set
      mysqli_free_result($result);
     } else{
     echo '<div class="alert alert-danger"><em>No records were found.</em></div>';
}
} else{
echo "Oops! Something went wrong. Please try again later.";
}

// Close connection
mysqli_close($link);
?>