Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

273
Visualizações
In a selection of clickable divs how can i know what one the user selected without reloading the page

So i have a selection of divs that get generated from and sql query.

 while ($row = mysqli_fetch_assoc($result)) { 
//  echo '<p class="data" >';

 foreach( $row AS $key=>$value) 
     {
        if ($key == "CodeID"){
            $CodeID=$value;
        }
            
        if ($key == "EventName"){
            $count +=1;
            // Use CodeId instead of Count
            echo "

            <div class='TheDiv' onclick='Expand()' style='order:".$count."'>
            <a href='?E=".$CodeID."'><p> ".$value."</p></a>

            </div>
            ";
        }

When a user clicks on one i want the "CodeID" to be stored in someway so then later i can use it to display a form:

If(ISSET($_GET["E"])){
    $ID=$_GET["E"];
    $_SESSION['varname'] = $ID;
    $query = "SELECT * FROM `qrcode` WHERE `CodeID` =".$ID.";";
    $result = $SQLConnection->RunMySQLi($query);
    while ($row = mysqli_fetch_assoc($result)) { //looping through the returned SQL rows one at a time
        echo '<p class="data" >';

Right now i do this with Href and passing ?E, but that reloads the page and my js animation from the "onClick" does not finish as the page reloads, can someone help me please

Thank you!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You could probably store information using the $_SESSION variable, Have you checked into javascript XHR ?

Maybe is that a solution to your problem

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda