In this form checkbox. checked data post to the another page.
I couldn't find the error on this code please help me.
I couldn't find the error on this code please help me.
Code:
<script language="javascript">
function add_variation()
{
var arr = new Array();
$(".add_var").each(function()
{
if($(this).attr("checked"))
{arr.push($(this).val());}
});
if(arr.length > 0)
{ $("#add_var_pid").val(arr); }
else
{ alert("At least one product should be select");
$("#add_var_pid").val('');
return false;
}
}
</script>
<form name="addvar" id="addvar" method="post" action="/cart/verify.asp" onsubmit="return add_variation();">
<table width="580" border="0" align="center" cellpadding="0" cellspacing="0" style="BORDER: 1px #FFFFFF solid;">
<tr bgcolor="#A48F50">
<td width="74%" height="18"class="PNameDetail"><b>Product Name</b></td>
<td bgcolor="#FFFFFF" height="15"><img src="/images/spacer.gif" alt="gif img" width="2" /></td>
<td width="10%" height="18" align="center" class="PNameDetail"><b>Price</b></td>
<td bgcolor="#FFFFFF" height="15"><img src="/images/spacer.gif" alt="gif img" width="2" /></td>
<td width="8%" height="18" align="center" class="PNameDetail"><b>Save</b></td>
<td bgcolor="#FFFFFF" height="15"><img src="/images/spacer.gif" alt="gif img" width="2" /></td>
<td width="8%" height="18" align="center" class="PNameDetail"><b>Select</b></td>
</tr>
<%
While Not RsProductVariation.EOF
If bgcolor = "#F7F6FE" Then bgcolor = "#E7E4F7" Else bgcolor = "#F7F6FE"
ProductNameFormat = ProductName
If Len(RsProductVariation("Potency")) > 0 Then ProductNameFormat = ProductNameFormat & " " & RsProductVariation("Potency")
If Len(RsProductVariation("Flavour")) > 0 Then ProductNameFormat = ProductNameFormat & " " & RsProductVariation("Flavour") %>
<tr bgcolor="<%=bgcolor%>">
<td width="74%" class="pd-productvariation"> <a href="<%=GetISAPI(RsProductVariation("PID") & "|" & RsProductVariation("Name"),"product")%>" rel="nofollow"><%=ProductNameFormat%> <%=RsProductVariation("Quantity")%></a></td>
<td bgcolor="#FFFFFF" height="20"><img src="/images/spacer.gif" alt="gif img" width="2" /></td>
<td width="10%" class="pd-productvariation" align="center"><%=FormatCurrency(RsProductVariation("Price"), 2)%></td>
<td bgcolor="#FFFFFF" height="20"><img src="/images/spacer.gif" alt="gif img" width="2" /></td>
<td width="8%" class="pd-productvariation" align="center"><%=Round(((( RsProductVariation("MSRP")-RsProductVariation("Price") )/RsProductVariation("MSRP")) * 100),0)%>%</td>
<td bgcolor="#FFFFFF" height="20"><img src="/images/spacer.gif" alt="gif img" width="2" /></td>
<td width="8%" align="center"><input name="add_var" id="add_var" type="checkbox" class="add_var" value="<%=Rs("PID")%>"/></td>
</tr>
<%
RsProductVariation.MoveNext
Wend%>
</table>
</td>
</tr>
<tr>
<td width="58" align="right">
<input type="image" name="img" value="img" src="/images/pdetail-addtocart.png" align="bottom" />
<input type="hidden" name="add_var_pid" id="add_var_pid" value="" /></td>
</tr>
<tr>
<td height="10" style="border-left:1px solid #CCCCCC; border-right:1px solid #CCCCCC"></td>
</tr>
</form>
Comment