Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda