Indkøbskurv
Jeg sidder og pusler med en indkøbskurv, men kan ikke få dataerne overførst til mail som skal sendes til mig når der en kunde der har bestilit en vare. Er der en der kan hjælpe?<%
Response.Expires = 0
Titel = \"Indkøbskurv\"
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"shop.mdb\")
Mode = LCase(Request.QueryString(\"Mode\"))
ID = CLng(Request.QueryString(\"ID\"))
Antal = CLng(Request.QueryString(\"Antal\"))
If CLng(Session(\"CartID\")) = 0 then
SQLstmt = \"INSERT INTO ShoppingCarts (SessionID, [Date]) VALUES (\" & Session.SessionID & \", \'\" & Now & \"\');\"
Conn.Execute SQLstmt
Set RS = Conn.Execute (\"SELECT * FROM ShoppingCarts ORDER BY ID Desc\")
Session(\"CartID\") = RS(\"ID\")
End If
Select Case Mode
Case \"tilfoej\"
If Not Conn.Execute(\"SELECT ID FROM Articles WHERE ID = \" & ID).EOF Then
If Conn.Execute(\"SELECT ID FROM ShoppingCartItems WHERE CartID = \" & Session(\"CartID\") & \" AND ArticleID = \" & ID).EOF Then
SQLstmt = \"INSERT INTO ShoppingCartItems (CartID, ArticleID, ArticleAmount) VALUES (\"
SQLstmt = SQLstmt & Session(\"CartID\") & \", \"
SQLstmt = SQLstmt & ID & \", \"
SQLstmt = SQLstmt & \"1);\"
Conn.Execute SQLstmt
Else
Conn.Execute \"UPDATE ShoppingCartItems SET ArticleAmount = ArticleAmount + 1 WHERE CartID = \" & Session(\"CartID\") & \" AND ArticleID = \" & ID
End If
End If
Case \"fjernvare\"
Conn.Execute \"DELETE FROM ShoppingCartItems WHERE ArticleID = \" & ID
Case \"nytantal\"
If Antal < 1 Then
Conn.Execute \"DELETE FROM ShoppingCartItems WHERE ArticleID = \" & ID
Else
Conn.Execute \"UPDATE ShoppingCartItems SET ArticleAmount = \" & Antal & \" WHERE ArticleID = \" & ID
End If
Response.Redirect \"viskurv.asp\"
Case \"toem\"
Conn.Execute \"DELETE FROM ShoppingCartItems\"
Response.Redirect \"viskurv.asp\"
Case \"indtastantal\"
SQLstmt = \"SELECT \"
SQLstmt = SQLstmt & \"(SELECT Name FROM Articles WHERE ID = ShoppingCartItems.ArticleID) AS ArticleText, \"
SQLstmt = SQLstmt & \"ArticleAmount \"
SQLstmt = SQLstmt & \"FROM ShoppingCartItems WHERE CartID = \" & Session(\"CartID\") & \" AND ArticleID = \" & ID & \";\"
Set RS = Conn.Execute(SQLstmt)
End Select
SQLstmt = \"SELECT \"
SQLstmt = SQLstmt & \"(ArticleAmount * (SELECT Price FROM Articles WHERE ID = ShoppingCartItems.ArticleID)) AS ArticlePriceTotal, \"
SQLstmt = SQLstmt & \"(SELECT Price FROM Articles WHERE ID = ShoppingCartItems.ArticleID) AS ArticlePrice, \"
SQLstmt = SQLstmt & \"(SELECT Name FROM Articles WHERE ID = ShoppingCartItems.ArticleID) AS ArticleText, \"
SQLstmt = SQLstmt & \"ArticleID, ArticleAmount \"
SQLstmt = SQLstmt & \"FROM ShoppingCartItems WHERE CartID = \" & Session(\"CartID\") & \"; \"
Set RSList = Conn.Execute(SQLstmt)
%>
<%
Select Case Mode
Case \"indtastantal\"
If Not RS.EOF Then
%>
<form action=\"viskurv.asp\" method=\"nytantal\">
<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"5\">
<tr>
<td colspan=\"3\"><font face=\'Verdana\' size=\'1\'><b><%= RS(\"ArticleText\") %></b><b></b></td>
</tr>
<tr>
<td width=\"1%\" nowrap>Nyt antal</td>
<td width=\"99%\">
<input type=\"text\" name=\"antal\" class=\"FlatInput\" maxlength=\"3\" value=\"<%= RS(\"ArticleAmount\") %>\" style=\"width=40; text-align=right;\">
</td>
<td width=\"1%\">
<input type=\"submit\" name=\"Submit\" value=\"OK\" class=\"FlatButton\">
</td>
</tr>
</table>
<input type=\"hidden\" name=\"id\" value=\"<%= ID %>\">
<input type=\"hidden\" name=\"mode\" value=\"nytantal\">
</form>
<%
End If
Case Else
If Not RSList.EOF Then
%>
<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"5\">
<tr>
<td width=\"1%\"><font face=\'Verdana\' size=\'1\'><center><b>Varenr.</b></td>
<td width=\"99%\"><font face=\'Verdana\' size=\'1\'><b>Tekst</b></td>
<td width=\"1%\"><font face=\'Verdana\' size=\'1\'><center><b>Antal</b></td>
<td width=\"1%\"><font face=\'Verdana\' size=\'1\'><center><b>á</b></td>
<td width=\"1%\"><font face=\'Verdana\' size=\'1\'><center><b>Total</b></td>
<td width=\"1%\"></td>
</tr>
<%
\'
Dim intTaeller
intTaeller = 0 \' start vare tælleren på 0
Do While Not RSList.EOF
intTaeller = intTaeller + 1 \' læg 1 til vare tælleren
%>
<tr>
<td><font face=\'Verdana\' size=\'1\'><center><%= RSList(\"ArticleID\") %></td>
<%
\' Dette indsætter et skujlt felt i din blanket med varens ID nummer til din e-mail behandling
Response.Write \"<input type=hidden name=\"\"vare\" & intTaeller & \"\"\" value=\"\"\" & RSList(\"ArticleID\") & \"\"\">\" & vbCrLf
\'
%>
<td><font face=\'Verdana\' size=\'1\'><a href=\"visvare.asp?id=<%= RSList(\"ArticleID\") %>\"><%= RSList(\"ArticleText\") %></a></td>
<td><font face=\'Verdana\' size=\'1\'><center><a href=\"viskurv.asp?mode=indtastantal&id=<%= RSList(\"ArticleID\") %>\"><font face=\'Verdana\' size=\'1\'><%= RSList(\"ArticleAmount\") %></a></td>
<td><font face=\'Verdana\' size=\'1\'><center><%= RSList(\"ArticlePrice\") %>,-</td>
<td><font face=\'Verdana\' size=\'1\'><center><%= RSList(\"ArticlePriceTotal\") %>,-</td>
<td><font face=\'Verdana\' size=\'1\'><a href=\"viskurv.asp?mode=fjernvare&id=<%= RSList(\"ArticleID\") %>\">Slet</a></font></td>
</tr>
<%
PriceTotal = PriceTotal + RSList(\"ArticlePriceTotal\")
RSList.MoveNext
Loop
\'
\' Dette indsætter et skjult felt i din blanket, der indeholder antallet af vare ID numre til de andre skjulte felter.
Response.Write \"<input type=hidden name=\"\"AntalVarer\"\" value=\"\"\" & intTaeller & \"\"\">\" & vbCrLf
\'
%>
<tr>
<td colspan=\"4\"><font face=\'Verdana\' size=\'1\'><b>Ialt</b></td>
<td><center><font face=\'Verdana\' size=\'1\'><%= PriceTotal %>,-</td>
<td> </td>
</tr>
</table>
<CENTER><FONT SIZE=\"1\" FACE=\"VERDANA\"><A HREF=\"midt.asp\">Tilbage</A></FONT></CENTER>
<%
Else
%>
<font face=\'Verdana\' size=\'1\'><center>Indkøbskurven er tom.<P><A HREF=\"midt.asp\">Tilbage</A></center>
<%
End If
End Select
%>
<BR><FONT FACE=\"VERDANA\" SIZE=\"1\"><B>* Skal udfyldes!</B></FONT>
<br>
<tr>
<td colspan=\"4\"align=\"left\"> <font face=\"Verdana\" size=\"1\"><B>*</B>Navn</font><br>
<input type=\"text\" name=\"navn\" size=\"40\"><BR>
</td>
</tr>
<tr>
<td colspan=\"4\"align=\"left\"> <font face=\"Verdana\" size=\"1\"><B>*</B>Adresse</font><br>
<input type=\"text\" name=\"adresse\" size=\"40\"><BR>
</td>
</tr>
<tr>
<td colspan=\"4\"align=\"left\"> <font face=\"Verdana\" size=\"1\"><B>*</B>Postnr</font><br>
<input type=\"text\" name=\"postnr\" size=\"4\" maxlength=\"4\"><BR>
</td>
</tr>
<tr>
<td colspan=\"4\"align=\"left\"> <font face=\"Verdana\" size=\"1\"><B>*</B>By</font><br>
<input type=\"text\" name=\"by\" size=\"40\"><BR>
</td>
</tr>
<tr>
<td colspan=\"4\"align=\"left\"> <font face=\"Verdana\" size=\"1\"><B>*</B>E-mail</font><br>
<input type=\"text\" name=\"email\" size=\"40\"><BR>
</td>
</tr>
<tr>
<td colspan=\"4\"align=\"left\"> <font face=\"Verdana\" size=\"1\">Telefon</font><br>
<input type=\"text\" name=\"telefon\" size=\"8\" maxlength=\"8\"><BR>
</td>
</tr>
<tr>
<td colspan=\"4\"align=\"left\"> <font face=\"Verdana\" size=\"1\">Kommentarer</font><br>
<textarea name=\"kommentarer\" cols=\"30\" rows=\"8\"></textarea><BR>
</td>
</tr>
<tr>
<td colspan=\"4\"align=\"left\">
<input type=\"submit\" name=\"submit\" value=\"Send bestilling\" style=\"font-family: Verdana; font-size: 9pt; font-weight: bold\">
</td>
</tr>
</form>
</table>