form 속성


action : 전송시 연결된 페이지

method : 전송방식

accept-charset : 데이터를 서버로 전송시 문자 인코딩 지정

enctype : 폼데이터를 전송시 인코딩 유형 지정

application/x-www-form-urlencoded : 모든 문자 인코딩

multipart/form-data : 파일 업로드 

text/plain : 공백은 +로 변환되고 특수문자는 인코딩 하지 않음



html)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" 
          content="width=device-width, height=device-height, 
                     minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0">
    <title>Insert title here</title>
    <style>
    </style>
</head>
 
<body>
    <!-- 
    action : 전송시 연결된 페이지
    method : 전송방식
    accept-charset : 데이터를 서버로 전송시 문자 인코딩 지정
    enctype : 폼데이터를 전송시 인코딩 유형 지정
        application/x-www-form-urlencoded : 모든 문자 인코딩
        multipart/form-data : 파일 업로드 
        text/plain : 공백은 +로 변환되고 특수문자는 인코딩 하지 않음
     -->    
    <form action="test.do" method="post" 
          accept-charset="utf-8"
          enctype="application/x-www-form-urlencoded">
        <fieldset>
            <p>
                <label for="loginid">아이디 : </label>
                <input type="text" id="id" name="loginid" value="" />
            </p>
            <p>
                <label for="loginpw">비밀번호 : </label>
                <input type="text" id="pw" name="loginpw" value="" />
            </p>
        </fieldset>      
        <input type="submit" value="send" />
    </form>    
</body>
</html>
cs



결과

버튼 클릭시 test.do 페이지로 데이터를 전송한다

+ Recent posts