티스토리 뷰

페이지를 만들때 제일 귀찮으면서 제일 많이 하면서 아마도 제일 중요하겠지.


Requeste된 데이터 확인


<html>
<head><title>Checkdata</title></head>

<body bgcolor="#ffffff"><p>
<b><font size= "3"face= "돋움">뭐가 빠졌을까요??확인해보세요.</font></b>
<p>
<table border="1" cellpadding="0" cellspacing="0" width="400">
<tr><td colspan="2" height="30">
<p align="center"><font size="2" face="돋움"color="#003399"><b>Querystring으로 넘어온 것
</b></font></td></tr>
<%
For each item in Request.QueryString
    for i = 1 to Request.QueryString(item).Count
%>
<tr>
<td width= "150" height= "25"><font face= "돋움"size="2">&nbsp;Request("<%=item%>")</font></td>
<td width= "250" height= "25"><font face= "돋움"size="2">&nbsp;<%=Request.QueryString(item)(i)%></font>
</td></tr>
<%
    next
next
%>
</table><p>

<table border="1" cellpadding="0" cellspacing="0" width="400">
<tr><td colspan="2" height="30">
<p align="center"><font size="2" face="돋움"color= "#003399"><b>Form으로 넘어온 것</b></font></td></tr>
<%
i=0
For each item in Request.Form
    for i = 1 to Request.Form(item).Count
%>
<tr>
<td width= "150"height= "25"><font face= "돋움"size="2">&nbsp;Request.form("<%=item%>")</font></td>
<td width= "250"height= "25"><font face= "돋움"size="2">&nbsp;<%=Request.form(item)(i)%></font></td>
</tr>
<%
    next
next
%>
</table>
</body>
</html>

바로 데이터를 불러오는 것

form 으로 보낸 데이터, querystring으로 보낸것을 체크한다.


이렇게 하면 어떤 데이터를 가져왔는지 체크가 된다.


아래처럼.



하지만 form이 enctype="multipart/form-data" 라면 아래처럼..




위 데이터를 매번 쓸려면 불편하니..

만들고

'-------------------------------------------------------------------------------------

'Form및 쿼리 값으로 넘어온 값들을 확인

'-------------------------------------------------------------------------------------

Sub printRequestValue()

'몽땅찍기

Dim strFormName


response.write("<br><br>GET  --------------------------------------------- <br>")

For Each reqItem In Request.QueryString

response.write "<li>" & reqItem & " = <b>'</b><font color='red'>" & Request.QueryString(reqItem) & "</font><b>'</b></li>"

Next


response.write("<br><br>POST  --------------------------------------------- <br>")

For Each reqItem In Request.Form

response.write "<li>" & reqItem & " = <b>'</b><font color='red'>" & Request.Form(reqItem) & "</font><b>'</b></li>"

Next


Response.Write "<br />"

End Sub


확인하기

Call printRequestValue()



결과값은 동일하다.

하지만 이렇게 모듈화를 해 놓으면 다음에 사용할때에도 그냥 해당sub를 호출만 하면 된다.