Isset does not work

1

Good afternoon.

I am doing a web application of shared races, type "Uber".

I want you to present a list of drivers registered on the bench on the green carousel.

However,astheimageshows,myissetdoesnotseemtobeworking,italreadyshowsmealltheconnectiontothebank,andIdonotknowhowtosolveit.

Thisismyconnectiontothebank:

<div><?phpif(isset($_POST['cpf'])){echo"<table>";
            echo "<tr>";
                echo "<th>NOME</th>";
                echo "<th>DISPONIBILIDADE</th>";
                echo "<th>CARRO</th>";
                echo "<th>CPF</th>";
                echo "<th>DATA DE NASCIMENTO</th>";
                echo "<th>SEXO</th>";
            echo "</tr>";

            $strcon = mysqli_connect('localhost', 'root', '') or die('Erro ao conectar ao banco de dados');
            mysqli_select_db($strcon, 'uber');
            $sql = "SELECT nome, disponibilidade, carro, cpf, nascimento, sexo FROM tb_motorista WHERE cpf = $_POST[cpf]";
            $resultado = mysqli_query($strcon,$sql) or die("Erro ao retornar dados");

            while ($registro = mysqli_fetch_array($resultado)) {
                $nome = $registro['nome'];
                $disponibilidade = $registro['disponibilidade'];
                $carro = $registro['carro'];
                $cpf = $registro['cpf'];
                $nascimento = $registro['nascimento'];
                $sexo = $registro['sexo'];
                echo "<tr>";
                    echo "<td>".$nome."</td>";
                    echo "<td>".$disponibilidade."</td>";
                    echo "<td>".$carro."</td>";
                    echo "<td>".$cpf."</td>";
                    echo "<td>".$nascimento."</td>";
                    echo "<td>".$sexo."</td>";
                echo "</tr>";
            }
            mysqli_close($strcon);
        echo "</table>";
    }else{
        echo 'Motra a lista de Motoristas';
    }
?>
</div>

The green carousel code, which I place the bank include:

<div class="carousel carousel-slider center" data-indicators="true" style="height: 480px;">
<div class="carousel-fixed-item center">
<a class="btn waves-effect white teal-text darken-text-2">Excluir</a>
</div>
<div class="carousel-item teal white-text" href="#one!">
<h2>Lista de Corridas</h2>
<p class="white-text"><div id="cons_motoca"><?php include("componentes/cons_motoca.php"); ?></div></p>
</div>
</div>

And the index, which has carousel include:

<?php include("componentes/header.php"); ?>

<div class="row">
<div class="col s4" style="">
    <div class="card">
        <div class="card-tabs">
            <ul class="tabs tabs-fixed-width">
                <li class="tab"><a href="#corridas" style="color: teal">Corridas</a></li>
                <li class="tab"><a href="#motorista" class="active" style="color: teal">Motorista</a></li>
                <li class="tab"><a href="#passageiro" style="color: teal">Passageiros</a></li>
            </ul>
        </div>
        <div class="card-content white lighten-4">
            <?php include("componentes/corrida.php"); ?>
            <?php include("componentes/motorista.php"); ?>
            <?php include("componentes/passageiro.php"); ?>
        </div>
    </div>
</div>
<div class="col s8">
<?php include("componentes/view.php"); ?>
</div>
</div>


<?php include("componentes/footer.php"); ?>
    
asked by anonymous 15.05.2018 / 18:56

1 answer

4

In this file here:

<div>
<? php // <<<<<<<<
    if(isset($_POST['cpf'])){
        echo "<table>";
            echo "<tr>";
                echo "<th>NOME</th>";
//...
</div>

php's opening tag should be

<?php 
    // codigo
?>
    
15.05.2018 / 19:03