<commit_before><?php
include_once("Sql.class.php");
$sql = new Sql;
if ($_SESSION['form'] == 1) {
    $tipo = "cadastro.php?acao=cadastro&passo=4"; 
} elseif ($_SESSION['form'] == 2) {
    $tipo = "cadastro.php?acao=cadastro&passo=7";
} else {
    $tipo = "cadastro.php?acao=cadastro&passo=3";
}

$maxPac = "SELECT MAX(pac_id) AS pac_id FROM paciente";
$idPac = $sql->selecionar($maxPac);
$selPac = "SELECT * FROM paciente WHERE pac_id='" . $idPac . "';";
$paciente = $sql->fetch($selPac);
?>
<form class="Form" action="<?=$tipo?>" method="post">
    <h1>Médico</h1>
    <div class="group-form group-form-cadastro">
     <label class="lbl_class">CRM:</label>
     <?php
     if ($_SESSION['form'] == 1) {
        $dis = "";
        $val = "";
     } else {
        $dis = "disabled";
        $val = " value=\"" . $medico[1] . "\"";
     }
     ?>
     <input class="inp_class" type="text" name="med_crm" size="28" <?=$val . $dis ?>><br>
     <label class="lbl_class">Especialização:</label>
     <?php
       if ($_SESSION['form'] == 1) {
        $sql->selectbox("especializacao");
       } else {
        echo "<input class=\"inp_class\" type=\"text\" name=\"med_crm\" size=\"28\" value=" . $esp[1] .  "><br>";
       }
     ?>
    </div>
</form><commit_msg>Backend: Selecionando dados dos campos<commit_after><?php
include_once("Sql.class.php");
$sql = new Sql;

if ($_SESSION['form'] == 1) {
    $tipo = "cadastro.php?acao=cadastro&passo=4";
} elseif ($_SESSION['form'] == 2) {
    $tipo = "cadastro.php?acao=cadastro&passo=7";
} else {
    $tipo = "cadastro.php?acao=cadastro&passo=3";
}

$maxMed = "SELECT MAX(med_id) AS med_id FROM medico";
$idMed = $sql->selecionar($maxMed);
$selMed = "SELECT * FROM medico WHERE med_id='" . $idMed . "';";
$medico = $sql->fetch($selMed);
?>
<form class="Form" action="<?=$tipo?>" method="post">
  <h1>Médico</h1>
  <div class="group-form group-form-cadastro">
    <label class="lbl_class">CRM:</label>
    <?php
    if ($_SESSION['form'] == 1) {
      $dis = "";
      $val = "";
    } else {
      $dis = "disabled";
      $val = " value=\"" . $medico[1] . "\"";
    }
     ?>
    <input class="inp_class" type="text" name="med_crm" size="28" <?=$val . $dis ?>><br>
    <label class="lbl_class">Especialização:</label>
    <?php
    if ($_SESSION['form'] == 1) {
      $sql->selectbox("especializacao");
    } else {
      // Pegando o nome da especialização
      $sel = "SELECT * FROM medico_has_especializacao WHERE medico_med_id='" . $idMed . "';";
      $esp = $sql->fetch($sel);
      $selEsp = "SELECT * FROM especializacao WHERE esp_id='" . $esp[2] . "';";
      $es = $sql->fetch($selEsp);

      echo "<input class=\"inp_class\" type=\"text\" name=\"esp_nome\" size=\"28\" value=" . $es[2] .  "><br>";
    }
    ?>
  </div>
</form>

{'fraction_non_alphanumeric': 0.23303411131059246, 'fraction_numerical': 0.011131059245960502, 'mean_word_length': 3.20211161387632, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2095635', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1085, 'n_words': 196}