0
我有一個通過Ajax構建以下表單的頁面。ASP MySQL循環數組
<form action="go.asp" method="get">
<!--row-->
<input type='hidden' name='BundleItemID' id='BundleItemID' value='123'/>
<input type='hidden' name='BundleColorID' id='BundleColorID' value='4'/>
<input type='hidden' name='BundleSizeID' id='BundleSizeID' value='Large'/>
<input type='hidden' name='BundleQtyID' id='BundleQtyID' value='4'/>
<!--#row-->
</form>
形式建立起與行之間的循環,使數據看起來就像是:
<form action="go.asp" method="get">
<!--row-->
<input type='hidden' name='BundleItemID' id='BundleItemID' value='123'/>
<input type='hidden' name='BundleColorID' id='BundleColorID' value='4'/>
<input type='hidden' name='BundleSizeID' id='BundleSizeID' value='Large'/>
<input type='hidden' name='BundleQtyID' id='BundleQtyID' value='4'/>
<!--#row-->
<!--row-->
<input type='hidden' name='BundleItemID' id='BundleItemID' value='123'/>
<input type='hidden' name='BundleColorID' id='BundleColorID' value='4'/>
<input type='hidden' name='BundleSizeID' id='BundleSizeID' value='Large'/>
<input type='hidden' name='BundleQtyID' id='BundleQtyID' value='4'/>
<!--#row-->
<!--row-->
<input type='hidden' name='BundleItemID' id='BundleItemID' value='123'/>
<input type='hidden' name='BundleColorID' id='BundleColorID' value='4'/>
<input type='hidden' name='BundleSizeID' id='BundleSizeID' value='Large'/>
<input type='hidden' name='BundleQtyID' id='BundleQtyID' value='4'/>
<!--#row-->
<!--row-->
<input type='hidden' name='BundleItemID' id='BundleItemID' value='123'/>
<input type='hidden' name='BundleColorID' id='BundleColorID' value='4'/>
<input type='hidden' name='BundleSizeID' id='BundleSizeID' value='Large'/>
<input type='hidden' name='BundleQtyID' id='BundleQtyID' value='4'/>
<!--#row-->
</form>
我希望提交一個表單go.asp - 這個網頁將行之間的所有內容循環,提交數據到mySQL,我的代碼到目前爲止:
<%
dim LoopData
for i=1 to Request.QueryString("BundleItemID").Count
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM tblProducts"
rs.Open sql, conn.c
While Not rs.EOF
LoopData = LoopData & Request.QueryString("BundleItemID")(i) & ""
sql= "INSERT INTO tblProducts (BundleItemID,BundleColorID,BundleSizeID,BundleQtyID) VALUES ("&request("BundleItemID")&","&request("BundleColorID")&","&request("BundleSizeID")&","&request("BundleQtyID")&")"
rs.MoveNext()
Wend
next
%>
我該怎麼做?
你知道這代碼很容易被sql注入,對吧? – 2011-11-21 23:14:50
是的。儘管ASP經典缺乏mySQL注入嘗試,但它在PHP中更常見 – TheBlackBenzKid 2011-11-22 08:11:42