How to post 3 values by selecting checkbox

Hello,

how do i send 3 values with a checkbox selected from list of products

<inpyt teype="checkbox" name="product[5]" value="10">

Product ID 5
Product quantity 10
Discount 25 (How can I post this discount with the same checkbox?)
I give discount value to products with “input type text” using jquery

Is it possible to post 2 inputs with a selected checkbox?

<inpyt teype="checkbox" name="product[5]" value="10">
<input type="text" name="discount" value="10">

Without any context, your question cannot be answered.

What does a checked checkbox mean (what is the data being used for)? How many checkboxes are there? What does it mean when more than one checkbox is checked? Is there a discount field for each checkbox or only one discount field? Is there a discount field for each product ID? Are you doing this for more than one product ID at a time?

In short, your example shows what you are trying to make work, not what the overall extents, limits, and meaning is of this web page and the data that it submits.

You’re right, below is the info.
There is more than one line
Each row has a checkbox (name="product[5]" value="20") Here 5 is the product ID number, 20 items quantity
Each line has an entry field for product discounts. (input type="text" name="discount[]")

The aim here is to select the desired products.
and to set the same or different discount for each product.

I want to POST the discount of the product along with the selected product.

I want to save in database as below:
products":[{"product_id":66,"quantity":"20.00","discount":"10.00"},{"product_id":"135","quantity":"3.00","discount":"12.00"}]

I forgot to write, I create product lines with foreach loop

Sponsor our Newsletter | Privacy Policy | Terms of Service