[HTML]form(action,method)

hello__0·2022년 10월 29일
0

action

  • 상대경로/ 절대경로 둘 다 가능
  • 양식 데이터를 처리할 프로그램의 URI
  • form 데이터의 서버를 모아서 서버로 전송할 수 있는데, 서버의 주소를 action에 넣는다고 생각하면 된다.

method

  • 서버 개발자가 form데이터를 보내달라고 요청할 때, 보내달라고 하는 요청 메서드로 보내주면 된다.
    POST: post 메서드. 양식 데이터를 요청 본문으로 전송한다.
    GET : get 메서드. 양식 데이터를 action URL과 ? 구분자 뒤에 이어 붙여서 전송한다.
    DIALOG : 양식이 <dialog> 안에 위치한 경우, 제출과 함께 대화 상자를 닫는다.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="printpage.css" />
</head>
<body>
    <h2>Form</h2>

    <form action="https://binggle-binggle.tistory.com/" method="GET">
        <input type="text" name="test">
        <button type="submit">제출</button>
    </form>

</body>

</html>

참고 : https://developer.mozilla.org/ko/docs/Web/HTML/Element/form

profile
자라나라 나무나무

0개의 댓글