I have a database with a table of CV´s where the client writes up all his info like (name, surname, professional experience, etc...) and on the html page I have 3 divs.
The 1st Div will show the whole CV form I'm planning on using echo $row=name separated using <br> below each line to separate it and display it as a real CV or Perhaps a Job Application form.
The 2nd Div will only contain a list of the names of the registered CV´s
and because I know little about jQuery or js I used buttons below each name, so that when clicked it compares the $userform variable to the row which has an equal name on the table and displays whole row on the 1st div separating each row by <br> or <p>.
First it will refresh the list on the 2nd div:
<div class="content2">
  <h3>LISTA DE CANDIDATOS:</h3>
  <form class="btn" method="post">
    <input type="submit" name="btn_search" value="Actualizar">
  </form>
  <br>
<?php if (isset($_POST["btn_search"])) {
  $con = mysqli_connect("localhost","root","","chevron");
  $q = "SELECT * FROM candidatos ORDER BY id DESC";
  $result = mysqli_query($con,$q);
  while ($row = mysqli_fetch_assoc($result)){
      $userform = $row["nome"] ;
      $_SESSION["userform"] = $userform;
      echo " ".$row['sobrenome'].",  ".$_SESSION['userform']." <br><br>"; ?>
      <form class="btn" action="" method="post">
          <input type="submit" name="post_form" value="Vizualizar CV">
      </form>
      <br>
<?php }
}
?>
</div>
After the mysqli_fetch_assoc I declare a variable $userform is equal to the row name(which means name in my language) and the global variable $_SESSION['userform'] is equal to that $userform variable which contains the row name.
Now the 1st div:
<div class="content">
  <br>
  <div class="form_cand">
    <br>
    <?php if (isset($_POST["post_form"])) {
      $con = mysqli_connect("localhost","root","","chevron");
      $q = "SELECT * FROM candidatos WHERE nome = ".$_SESSION["userform"]." ";
      $result = mysqli_query($con, $q);
      if (!$result) {
        echo "ERROR";
      }
      $row = mysqli_fetch_array($result);
      echo "NOME: ".$row["nome"]."<br>";
      echo "SOBRENOME: ".$row["sobrenome"]."<br>";
      echo "MORADA: ".$row["morada"]."<br>";
      echo "BI: ".$row["bi"]."<br>";
      echo "EMAIL: ".$row["email"]."<br>";
      echo "COMPETENCIAS: ".$row["competencias"]."<br>";
      echo "IDIOMAS: ".$row["idiomas"]."<br>";
      echo "OBJECTIVO: ".$row["objectivo"]."<br>";
    }
  ?>
  </div>
</div>
Based on the $userform variable which is in the Session Variable it should find the name which is equal to the one in the session variable and show the whole row but I don't know why it is not showing?
UPDATE:
I got the 1st part working thank you for the help! now I have added 2 buttons and a checkbox on the while condition for when the data is posted the buttons and the checkbox appear as well, one is button is DENY and the other ACCEPT.
when I click on Deny I want it to delete the current posted info from that table and send it over to another table which for eg. could be "DeniedCV´s" and the accept button to do practically the same thing but sending it over to the "ACCEPTEDCV´s" table.
but when the ACCEPT button is clicked and the checkbox checked, I want it to the same thing, but this time sending the data to 2 other tables ass well.
here is what I've done so far:
<div class="content">
  <br>
  <div class="form_cand">
    <br>
    <?php if (isset($_POST["post_form"])) {
      $selectedUser = intval($_POST['users']); //pra selecionar o nome clicado na option list
        if($selectedUser > 0){
          $con = mysqli_connect("localhost","root","","chevron");
            $q = "SELECT * FROM candidatos WHERE id = ".$selectedUser." ";
                $result = mysqli_query($con, $q);
                      if (!$result) {
                      echo "ERROR";
                          }
                    $row = mysqli_fetch_array($result);
                      if(is_array($row) && count($row) > 0){
                         echo "<center><strong>CANDIDATO Nº.:</strong>".$row["id"]." <br><br><br></center>";
                          echo "<strong>NOME:</strong><br>".$row["nome"]."<br><br><br>";
                        echo "<strong>SOBRENOME:</strong><br> ".$row["sobrenome"]."<br><br><br>";
                                          echo "<strong>MORADA:</strong><br> ".$row["morada"]."<br><br><br>";
                                          echo "<strong>BI:</strong><br> ".$row["bi"]."<br><br><br>";
                                          echo "<strong>EMAIL:</strong><br> ".$row["email"]."<br><br><br>";
                                          echo "<strong>COMPETENCIAS:</strong><br> ".$row["competencias"]."<br><br><br>";
                                          echo "<strong>IDIOMAS: </strong><br>".$row["idiomas"]."<br><br><br>";
                                          echo "<strong>OBJECTIVO:</strong><br> ".$row["objectivo"]."<br>"; ?>
                                          <center>
                                          <form class="decisions" action="" method="post">
                                          <p>
                                            Se achar esta candidatura excepcional e quiser mostra-la ao ADMINISTRADOR marque a caixinha pequena que esta apos o botão qualificado!
                                          </p>
                                          <input type="submit" name="btn_deny" value="NÃO QUALIFICADO">
                                          <!-- botao negar -->
                                          <?php if (isset($_POST['btn_negar'])) {
                                                  $selectedUser = intval($_POST['users']);
                                                  if($selectedUser > 0){
                                                      $con = mysqli_connect("localhost","root","","chevron");
                                                      $q = "SELECT * FROM candidatos WHERE id = ".$selectedUser." ";
                                                      $result = mysqli_query($con, $q);
                                                      if (!$result) {
                                                          echo "ERROR";
                                                      }
                                                      $row = mysqli_fetch_array($result);
                                                      if(is_array($row) && count($row) > 0){
                                                             //I WANTED TO PUT ANOTHER $q =  wich inserts Into another table
                                                             //and then add another $q = wich deletes it from the current table
                                                          
                                          } ?>
                                           <!-- botao negar -->
                                          <input type="submit" name="btn_aceitar" value="QUALIFICADO">
                                          <!-- botao aceitar -->
                                          <?php if (isset($_POST['btn_accept'])) {
                                          } ?>
                                           <!-- botao aceitar -->
                                          <input type="checkbox" name="checkbox_recomend" value="Recomendar ao Administrador">
                                          </form>
                                          </center>
                                            <?php  }
                                               }
                                             }
                                             ?>
  </div>
</div>
 
     
     
    