Wednesday, 19 April 2017

DELETE and POST in same form

Is there a way to have a POST and DELETE request inside the same form tags? I have a table and I want to delete that row when its chose.

I can only seem to get one but not both to work. Thanks!!

<form action="" method="post">
  <div class="container-fluid">
      <div class="row">
        <div class="col-lg-6" class = "text-center">
          <h2>Responsibility Day!!</h2>
                  <table class="table table-striped" id="tab">
                    <thead>
                      <tr>
                        <th>Name</th>
                        <th>Task</th>
                        <th></th>
                      </tr>
                    </thead>
                    <tbod>
                      <% for(var i=0; i<persons.length; i++){ %>
                        <tr>
                          <td><%= persons[i].name %></td>
                          <td><%= persons[i].task %></td>
                          <td ><a href="/tasklist/<%= persons[i].name%>/<%= persons[i].task%>"><button class="glyphicon glyphicon-remove" ></button></a></td>
                        </tr>
                      <% } %>
                      <tr>
                        <td><input type="text" name="name"></td>
                        <td><input type="text" name="task"></td>
                      </tr>
                    </tbod>
                  </table>
                </div>
              </div>
              <button class="btn btn-primary" id="addToList" type="submit">Submit</button>
            </div>
</form>



via Jundallah3

No comments:

Post a Comment