Kedar Pawgi

Kedar Pawgi

  • 1.6k
  • 136
  • 63.5k

passing ids of dyanmically generated textbox in php to js

Aug 23 2014 5:29 AM
Hi i need urgent help..i am creating shopping cart where every thing is working fine. What i want is when a use click on a button for changing quantity, he get prompt for entering new after entering the qty.
Once the quantity is entered it calculate the total amount as price * qty. This is also working fine.
This works fine if there is only one item in the shopping cart. If there are multiple items in the cart, user get prompt proper and amount is calculated properly but it gets posted on the 1st item only, this is because the all the items are loaded via a while loop, for every row a text boxes are generated dynamically. Now i want to know how i can pass the unique id (for
quantity textbox for accepting qty ) of the current row

following is the code where the textboxes and quantity are generated depending upon no of rows in cart.

<code>
 <input name="txtBookQty" type="text" id="txtBookQty"  size="5" style="text-align:center; font-size:16px; font-family:Calibri"
              value="<?php echo  ''.$row['bookQty'].''  ?>" readonly="readonly"      />

</code>




Code for button
<code>

<input type="button" VALUE="prompt" >

</code>


Please help regarding this asap i need to make this live.
thanks in advance.