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

142
Vistas
How can I save checkbox state to my database?

I'm trying to create a Todo-list app using (nodejs,ejs...) so for every todo I create a checkbox. If someone finishes his job and uses the button bin recycle to delete it, I save that using MongoDB but I've a problem when checking. When I reload the page this checked box disappears. In other words, my question is: How to save the information in my database if the checkbox is checked?

<div class="box">

  <% DoList.forEach(function(elem) { %>
    <div class="item">
      <input type="checkbox">
      <p class=i tems>
        <%=elem %>
      </p>
      <form action="/delete" method="post">
        <button class="delete" type="submit" name="delete" value='<%=elem%>'><img src="stylee/bin.png" alt="bin cycle"></button>
      </form>
    </div>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

add your checkbox inside the form and add something like $yourcheckbox= isset($_POST['yourcheckboxname'])?1:0; 1 mean check 0 mean uncheck

about 4 years ago · Juan Pablo Isaza Denunciar
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