asp中检查没有数据提交的页面ⅱ
2000-08-27· 编译:甘冀平·yesky
对于一个表单,使用put和get方法
这同样适用于从带有查询字符串连接而来的页面,比如?id=236454
< %
if request.querystring = "" then
response.write("< p align=""center"" >< font face=""arial"" >there was an
error.< br >" & vbcrlf)
response.write("no data was posted.< /font >
" & vbcrlf)
response.end
end if
% >
为了含概上面例子中的情况,要做下面的工作。尽管还有简单的方法,但是这个例子对于初学者,将是很好的学习基本原理的方法。
< %
isdata = 0
if request.form < > "" then isdata = isdata + 1
if request.querystring < > "" then isdata = isdata + 1
if isdata = 0 then
response.write("< p align=""center"" >< font face=""arial"" >there was an error.< br >" & vbcrlf)
response.write("no data was posted.< /font >
" & vbcrlf)
response.end
end if
% >
或者
< %
isdata = "no"
if request.form < > "" then isdata = "yes"
if request.querystring < > "" then isdata = "yes"
if isdata = "no" then
response.write("< p align=""center"" >< font face=""arial"" >there was an error.< br >" & vbcrlf)
response.write("no data was posted.< /font >
" & vbcrlf)
response.end
end if
%>
