How to get data from a modal page?

Asked

Viewed 72 times

1

I have a main page with a simple form:

<div class="col-sm-6">
  <label for="tipo">Tipo de sessão:</label>
  <select class="form-control" name="tipo">
    <option value="1">opcao 1</option>
    <option value="2">opcao 2</option>
  </select>
</div>

<div class="col-sm-6">
  <label for="data">Data:</label>
  <input type="date" class="form-control" name="data" required>
</div>

<div class="col-sm-3">
 Funcionario
  <div class="card">
    <img class="card-img-top" src="..." alt="Funcionario">
    <div class="card-body">
      <h5 class="card-title">Funcionario</h5>
      <a href="#" class="btn btn-primary">Selecionar...</a>
    </div>
  </div>
</div>

I have another page that lists employee items:

while ($sessao = mysqli_fetch_assoc($result)){
  echo '<div class="media col-sm-6">
          <div class="media-body">
            <h2 class="mt-0">'.$sessao['nome'].'</h2>
            <a class="btn btn-primary" href="DEVERIA SELECIONAR AQUI.php?id='.$sessao['id'].'">Seleciona</a>
            <a class="btn btn-danger" href="deleteFlor.php?id='.$sessao['id'].'">Excluir</a>
          </div>
        </div>';
}
?>

How to make the first page open the second (being a MODAL) and the second page, when selecting the employee, it is displayed on the first screen?

There’s probably something like this already in the community, but since I don’t know the name of this technique, I’m asking the question.

  • Let me see if I understand, you select on the fixed page, open the modal, select in the modal and the result appears on fixed?

  • 1

    That’s right they Smith

  • using $.ajax(), when you select the employee, in the return function success vc inserts the data on the fixed page.

  • and closes the modal

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.