Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

267
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!