Hello people,
I am trying a shopping application. when the user vists the products page the list of products is being
displayed depending on the number of products available in the database and their is a link tag add to basket,
this is used to place an item into the cart.
Right now the user cannot enter a quantity. The link tag works fine now but when I try to
add a text box or an option button so that the user can enter or select the quantity then how do I pass this
value also to the href tag. I tried NQuantity=NQuantity.value does not work.
I also tried using a submit button but then only the last products values are passed as parameters.
How do I call submit on href and how should the submit function be? Example code will be very helpful.
Thanks in advance for your time.
<select name='nQuantity'>
<option value='1'>1 1Pack</option>
<option value='2'>2 2Packs</option>
<option value='3'>3 3Packs</option>
</select>
<%
productList = (ArrayList)session.getAttribute("productlist");
System.out.println("the product list inside jsp -->"+productList);
ProductDetailsKS product = null;
if(productList!=null && productList.size()>0){
for( i=0; i<productList.size(); i++){
product = (ProductDetailsKS)productList.get(i);
%>
<% String pname=product.getProductname();
String cost = product.getPrice();
String total=(String)session.getAttribute("total");
String pid =product.getProductid();
String pimage = product.getProductimage();
%>
href="../Controller?pname=<%=pname%>&cost=<%=cost%>&action=cart&total=<%=total%>&pid=<%=pid%>&nQuantity=nQuantity.value">
}
}