我有一个输入字段,其值来自变量,当我将表单记录插入作为空行提交时:(
如果我检查我的页面的视图源,它会清楚地打印该值,但不会插入它。
这是输入字段:
<input name="uid" type="text" value="<%Response.Write(studentid)%>" disabled="disabled" />
这是插入代码:
<%
if request.Form("MyRecord")="Insert" then
Set InsCom=Server.CreateObject("ADODB.Command")
InsCom.ActiveConnection=objConn
InsF = Trim(request.Form("uid"))
InsF = replace(InsF,"'","''")
InsCom.CommandText = "Insert into talent_hunt(uid)Values(?) "
InsCom.Parameters.Append InsCom.CreateParameter("@uid", adVarChar, adParamInput, 255, InsF)
InsCom.Execute
response.Write"Record Inserted Successfully!<br /><a href=""talent-hunt.asp"" />Go Back to main page</a>"
end if
%>
请帮忙......
答案 0 :(得分:1)
使用readOnly
代替disabled
。
REF。线程:How can I get the form value from a disabled <input> element