Ursäkta mig men det där är nog den mest röriga kod jag någonsin sett :)
Har du gjort allt själv eller bara kopierat från någon gratisvariant?
Hej jag har en liten shop där man kan lägga in hur mycket man har av varje produkt på lager tex man har 5 hemma. Men jag vill när kunden klicka på köp så ska det ändras i databasen till 4 osv. Här är sidan men jag har försökt att klura ut hur man gör men fattar tyvärr inte att och ber verkligen om er hjälp.
<!-- #INCLUDE FILE="settings.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Ny sida 1</title>
<script type="text/javascript">
function imgPopup5(url){
var loader=new Image();
var top=parseInt(screen.height/2-50); var left=parseInt(screen.width/2-50);
var tempwin=window.open("","","scrollbars=no,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=100,height=100,top="+top+",left="+left);
with(tempwin.document){
open();
write("<html><head><title>Bildvisare</title></head><body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 rightmargin=0 style=\"overflow:hidden;background-color:black;color:white;\">");
write("Please wait...");
write("</body></html>");
close();
}
loader.onload=function(){
var top=parseInt(screen.height/2-this.height/2);
var left=parseInt(screen.width/2-this.width/2);
tempwin.close();
MyWin = window.open("","","scrollbars=no,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width="+this.width+",height="+this.height+",top="+top+",left="+left);
with(MyWin.document){
open();
write("<html><head><title>Bildvisare</title></head><body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 rightmargin=0 style=\"overflow:hidden;\">");
write("<img id='myimg' src=\""+url+"\">");
write("</body></html>");
close();
}
}
loader.src=url;
}
</script>
<%
id=Request.Querystring("code_no")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("databas/main.mdb")
sqlstmt = "SELECT * FROM products where code_no = '" & id & "' ORDER BY id"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sqlstmt, DSNtemp, 3, 3
TotalRecs = rs.recordcount
%>
<%
if trim(rs("opt1")) <> "" then
str_option = "document.itemsform.id" & rs("code_no") & "option.options[document.itemsform.id" & rs("code_no") & "option.selectedIndex].text"
else
str_option = "' '"
end if
if trim(rs("opt11")) <> "" then
str_option2 = "document.itemsform.id" & rs("code_no") & "option2.options[document.itemsform.id" & rs("code_no") & "option2.selectedIndex].text"
else
str_option2 = "' '"
end if
%>
</head>
<body topmargin="3" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<table border="0" width="750" height="482" cellspacing="1" cellpadding="0">
<tr>
<td height="480" width="12"> </td>
<td height="480" width="540" valign="top">
<br>
<center>
<FORM NAME="itemsform">
<INPUT NAME="id<% = rs("code_no")%>number" TYPE=Hidden VALUE="<% = rs("code_no")%>">
<table BORDER=0 CELLSPACING=2 WIDTH="484" HEIGHT="423" >
<tr>
<td WIDTH="478" HEIGHT="198">
<img src="images/<% = rs("image")%>" width="380"> <br><br>
<b><font face="Verdana" style="font-size: 13pt"><% = rs("item")%></font></b><br><br>
<font size="2" face="Verdana"><b>
<font face="Arial"><span style="font-size: 11pt">
<font face="Verdana"><span style="font-size: 9pt">
<INPUT TYPE="value" NAME="id<% = rs("code_no")%>quant" VALUE="1" SIZE=2>
<%if trim(rs("opt1")) <> "" then%>
<%if trim(rs("opt1")) <> "" then%>
<SELECT name="id<% = rs("code_no")%>option" onChange="url=this.options[this.selectedIndex].value; if(url){ location.href=url; }">
<OPTION><% = rs("opt1")%></OPTION>
<% end if %>
<%if trim(rs("opt2")) <> "" then%>
<option value="<% = rs("adress2")%>"><% = rs("opt2")%></OPTION>
<% end if %>
<%if trim(rs("opt3")) <> "" then%>
<option value="<% = rs("adress3")%>"><% = rs("opt3")%></OPTION>
<% end if %>
<%if trim(rs("opt4")) <> "" then%>
<option value="<% = rs("adress4")%>"><% = rs("opt4")%></OPTION>
<% end if %>
<%if trim(rs("opt5")) <> "" then%>
<option value="<% = rs("adress5")%>"><% = rs("opt5")%></OPTION>
<% end if %>
<%if trim(rs("opt6")) <> "" then%>
<option value="<% = rs("adress6")%>"><% = rs("opt6")%></OPTION>
<% end if %>
<%if trim(rs("opt7")) <> "" then%>
<option value="<% = rs("adress7")%>"><% = rs("opt7")%></OPTION>
<% end if %>
<%if trim(rs("opt8")) <> "" then%>
<option value="<% = rs("adress8")%>"><% = rs("opt8")%></OPTION>
<% end if %>
<%if trim(rs("opt9")) <> "" then%>
<option value="<% = rs("adress9")%>"><% = rs("opt9")%></OPTION>
<% end if %>
<%if trim(rs("opt10")) <> "" then%>
<option value="<% = rs("adress10")%>"></OPTION>
<% end if %>
</SELECT>
<% end if %>
<%if trim(rs("opt11")) <> "" then%>
<%if trim(rs("opt11")) <> "" then%>
<SELECT name="id<% = rs("code_no")%>option2" class="field">
<OPTION><% = rs("opt11")%></OPTION>
<% end if %>
<%if trim(rs("opt12")) <> "" then%>
<OPTION><% = rs("opt12")%></OPTION>
<% end if %>
<%if trim(rs("opt13")) <> "" then%>
<OPTION><% = rs("opt13")%></OPTION>
<% end if %>
<%if trim(rs("opt14")) <> "" then%>
<OPTION><% = rs("opt14")%></OPTION>
<% end if %>
<%if trim(rs("opt15")) <> "" then%>
<OPTION><% = rs("opt15")%></OPTION>
<% end if %>
<%if trim(rs("opt16")) <> "" then%>
<OPTION><% = rs("opt16")%></OPTION>
<% end if %>
<%if trim(rs("opt17")) <> "" then%>
<OPTION><% = rs("opt17")%></OPTION>
<% end if %>
<%if trim(rs("opt18")) <> "" then%>
<OPTION><% = rs("opt18")%></OPTION>
<% end if %>
<%if trim(rs("opt19")) <> "" then%>
<OPTION><% = rs("opt19")%></OPTION>
<% end if %>
<%if trim(rs("opt20")) <> "" then%>
<OPTION><% = rs("opt20")%></OPTION>
<% end if %>
</SELECT>
<% end if %>
<%
Function Free(txt)
txt = Replace(Trim(txt), vbCrLf, "<br>")
Free = txt
End Function
%>
<font style="font-size: 9pt" face="Verdana"></b>
<INPUT TYPE="button" NAME="id<% = rs("code_no")%>add" VALUE="Köp" onclick="top.center.cart.addItem('<% = rs("item")%>','<% = rs("price")%>', document.itemsform.id<% = rs("code_no")%>quant.value, '<% = rs("code_no")%>', <%=str_option %>, <%=str_option2 %>, '<% =RS("shipping") %>')";>
</font>
<p><font style="font-size: 9pt" face="Arial"><b>
Lagerstatus:</b> </font><font face="Arial" style="font-size: 9pt" color="#000000"><span style="background-color: #FFFF00"><b><%
Select Case rs("inlager")
Case 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50
Response.Write "Finns i lager"
Case 8
Response.Write "8 st"
Case 2,3,4,5,6,7
Response.Write "Finns i lager"
Case 0,1
Response.Write "Tillfälligt slut"
Case Else
Response.Write "Finns i lager"
End Select
%> </b>
</span></font><font face="Arial" style="font-size: 9pt" color="#000000"></font><font style="font-size: 9pt" face="Arial"><br><br>
<b>Inkl.moms:</b> <% = rs("price")%> Kr
</b><b>Artnr:</b> <% = rs("code_no")%></b><br><b><br><br>Produktbeskrivning:</b> <br><br><%=Free(Rs("pentry"))%></td>
</tr>
<tr>
<td WIDTH="478" HEIGHT="125"> </td>
</tr>
</table>
</FORM>
</td>
<td height="480" width="4" valign="top"></td>
<td height="480" width="189" valign="top"><!--#INCLUDE File="right_menu1.asp" --></td>
</tr>
</table>
</div>
</body>
</html>

