您的代碼基本上是正確的,所以只是刪除Response.Write
和做別的事情與fieldName
和fieldValue
變量,你填充。在完成操作數據(將數據插入到數據庫或發送電子郵件)後,可以將用戶重定向到成功/感謝頁面。
要測試您收到正確的輸入,你可以改變你Response.Write
到
Response.Write fieldName & " = " & fieldValue & "<br>"
更新
這裏是你如何可以使用Dictionary對象,把您的字段名稱和字段值在一起:
Dim Item, fieldName, fieldValue
Dim a, b, c, d
Set d = Server.CreateObject("Scripting.Dictionary")
For Each Item In Request.Form
fieldName = Item
fieldValue = Request.Form(Item)
d.Add fieldName, fieldValue
Next
' Rest of the code is for going through the Dictionary
a = d.Keys ' Field names '
b = d.Items ' Field values '
For c = 0 To d.Count - 1
Response.Write a(c) & " = " & b(c)
Response.Write "<br>"
Next
http://stackoverflow.com/q/9093918/69820 – 2012-02-01 13:01:49