-4

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>
Rana
  • 2,500
  • 2
  • 7
  • 28

1 Answers1

0

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