在PHP中传递购物车的数量[重复]

I have this kind of a dataset in my process to prepare a shopping cart

enter image description here

Apart from quantity everything comes from the db here, when add to cart it successfully passes #id with it but for number of hours i have been unable to find a way to pass the quantity along with it...so can somebody please find me a way to do this

{% extends 'base.html.twig' %}


{% block body %}


    <h2 class="page-header">Book List</h2>
    <table class="table table-striped">
   <thead>
      <tr>
         <th>#</th>
         <th>Book Title</th>
         <th>Catogory</th>
         <th>Price</th>
         <th>Quantity</th>
      </tr>
   </thead>
   <tbody>
    {% for booklist in booklist %}
      <tr>
         <th scope="row">{{booklist.id}}</th>
         <td>{{booklist.bookname}}</td>
         <td>{{booklist.category}}</td>
         <td>{{booklist.price}}</td>
         <td><input type="text" class="number quantity" id="quantity" name="quantity" value="1" required></td>
         <td>
         <a href="/Booklist/details/{{booklist.id}}" class="btn btn-success">Add to Cart</a>
         <a href="/Booklist/edit/{{booklist.id}}" class="btn btn-default">Check</a>
         </td>
      </tr>
      {% endfor %}
   </tbody>
</table>


{% endblock %}
</div>

There seems to be no <form> so I'm wondering how you are seeing this:

"when add to cart it successfully passes #id with it."

Since your "add-to-cart" is an <a> tag and not an <input type="submit" value="Submit"> button for submitting regular forms, I'm wondering if you have some AJAX sending the request for you?

Generally, you submit form data with simple HTML, sending everything between the <form> tags:

<form action="/action_page.php">
  First name:<br>
  <input type="text" name="firstname" value="Mickey"><br>
  Last name:<br>
  <input type="text" name="lastname" value="Mouse"><br><br>
  <input type="submit" value="Submit">
</form>

Or using AJAX (this example uses jQuery):

$.post( "test.php", { name: "John", time: "2pm" })
  .done(function( data ) {
    alert( "Data Loaded: " + data );
  });

Hope this answers your question.