My system has to do a search, using the cpf of a patient, then when he enters his cpf, he has to have a search in the bank, where the php will get all the information that the patient has with that cpf that he (ie he already has a registration, with name, cpf, age, sex and etc ...) and bring everything in the corresponding inputs of the html page, the same page that he used to register, but will be type one clone of it.
the query code
<h2>Consultar Ficha do Paciente</h2>
<div>
<input class="campo-form" type="text" name="cpf" placeholder="CPF" maxlength="14"></br>
</div>
<div class="groupb">
<button class="botao" type="submit">Buscar</button>
</div>
<div class="groupb">
<a href="php/menuNutricionista.php" class="botoes">Voltar</a>
</div>
</form>
the php code
<?php include("conexao.php"); $pdo=conectar(); $cpf = $_POST['cpf']; $consulta= $pdo->prepare("SELECT cpf FROM paciente where cpf = $cpf"); ?>
I am in doubt about this code, probably wrong and with some missing lines. I wanted someone to explain to me how to do a correct PDO query structure.