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

118
Views
Modal tot pop up from a link

I have the following code

echo "<td class = container_update ><a href = 'ShowAngajati.php?id=$row[ID_Angajati]
                                                                          &nm=$row[Nume]
                                                                          &pr=$row[Prenume]
                                                                          &cn=$row[CNP]
                                                                          &dn=$row[Data_Nasterii]
                                                                          &se=$row[Sex]
                                                                          &nr=$row[Numar_Telefon]
                                                                          &sa=$row[Salariu]
                                                                          ' id='myBtn'>Update</a></td>";


and the script

<script>
// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal 
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
</script>

Thing is I want a modal to pop up when i click on the link ("Update"). It does pop up but only for a second (while the tab is refreshing) and it pops up only when i click on the first row of my table. The conlusion would be: I'd have a big table (for a database) with a "update" button on each row that when i click would pop out a modal with an already completed form (completed with the data already in my database) and just change the thing i want to change (that's why i need the nm, pr, cn and so on variables).

about 4 years ago · Santiago Trujillo
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!