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

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

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 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!