Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Something wrong with this Supply Cart

Status
Not open for further replies.

gamble1

MIS
Oct 11, 2001
4
US
HTML: (thanks for any help!!!)
<HTML>
<HEAD>
<TITLE>Simple Shopping Cart Example</TITLE>
</HEAD>

<BODY>

<CENTER><H1>Supply Shop</H1></CENTER>

<HR>

<FORM ACTION=&quot;SupplyCart.asp&quot; METHOD=&quot;post&quot;>
<TABLE CELLSPACING=&quot;5&quot; CELLPADDING=&quot;5&quot;>
<TR>
<TD ALIGN=&quot;LEFT&quot;><B>Add to Cart</B></TD>
<TD ALIGN=&quot;center&quot;></TD>
</TR>
<TR>

<TD ALIGN=&quot;right&quot;><SELECT MULTIPLE SIZE=&quot;2&quot; NAME=&quot;item&quot;>
<OPTION>Pencils
<OPTION>Pens
<OPTION>Notebook Paper
<OPTION>Notebooks
</SELECT>
<TD></TD>

</TR>

</TABLE>
<HR>
<INPUT TYPE=&quot;Submit&quot; VALUE=&quot;Add to Cart&quot;>
</FORM>

</BODY>
</HTML>


ASP:

<%@Language=JScript%>
<%Response.buffer=true%>
<HTML>
<HEAD>
<TITLE>Simple Shopping Cart Example</TITLE>
</HEAD>

<BODY>

<CENTER><H1>Student's Supply Shop</H1></CENTER>

<H2>Items currently in your cart</H2>
<HR>
<%
var i,j,itemcount,item,items;

if (Request.Cookies(&quot;SupplyCart&quot;) == &quot;&quot;) {
Response.Cookies(&quot;SupplyCart&quot;)(&quot;itemcount&quot;) = 0;
itemcount = 0;
j = 0;
}
else
{
itemcount = Request.Cookies(&quot;SupplyCart&quot;)(&quot;itemcount&quot;);
j = 0;
}


for (i=0; i<itemcount; i++) {

Response.Cookies(&quot;SupplyCart&quot;)(&quot;item&quot;+i) = Request.Cookies(&quot;SupplyCart&quot;)(&quot;item&quot;+i);
Response.Write(Request.Cookies(&quot;SupplyCart&quot;)(&quot;item&quot;+i)+&quot;<BR>&quot;);
j = j + 1;
}


items = new Enumerator(Request.Form(&quot;item&quot;));
while (!items.atEnd())
{
item = items.item();
Response.Cookies(&quot;SupplyCart&quot;)(&quot;item&quot;+j) = item;
Response.Write(item+&quot;<BR>&quot;);
j = j + 1;
items.moveNext();
}

ExpireDate = new Date();
ExpireDate.setMonth(ExpireDate.getMonth()+3); //Expires in 3 months from today
Response.Cookies(&quot;SupplyCart&quot;).expires = ExpireDate.toLocaleString(); <<<<is it this?

Response.Cookies(&quot;SupplyCart&quot;)(&quot;itemcount&quot;) = j;
%>

<HR>
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top