Forum Moderators: open
This is probably a simple problem, but i can't seem to get it working.
I have a link which is created with a php while loop.
Each loop gives some product info, a quantity box and an add link.
I want the link quantity value to change when a the text field next to it is changed.
<input type="text" name="loopQty" id="loopQty" value="<?php echo $cr2['qty'];?>" class="textbox" size="3">
<a href="cart.php?xCmd=add&xProd=<?php echo $cr2['productID'];?>&qty<?php echo $cr2['productID'];?>=changewithfield">{labels.cart.addToCartLink}</a>
It's the section =changewithfield near the link end that needs to change with the input field.
Any help much appreciated. :)
<input type="text" name="loopQty" id="loopQty" value="<?php echo $cr2['qty'];?>" class="textbox" size="3">
<a href="javascript://" onClick="top.location='cart.php?xCmd=add&xProd=<?php echo $cr2['productID'];?>&qty<?php echo $cr2['productID'];?>='+document.getElementById('loopQty').value">{labels.cart.addToCartLink}</a>
I amended it to work with each item in the list.
<input type="text" name="loopQty<?php echo $cr2['productID'];?>" id="loopQty<?php echo $cr2['productID'];?>" value="<?php echo $cr2['qty'];?>" class="textbox" size="3">
<a href="javascript://" onClick="top.location='cart.php?xCmd=add&xProd=<?php echo $cr2['productID'];?>&qty<?php echo $cr2['productID'];?>='+document.getElementById('loopQty<?php echo $cr2['productID'];?>').value">{labels.cart.addToCartLink}</a>
Thanks again for the help.