HTML form method 속성은 URL 변수로 보내거나 HTTP post transaction으로 보낼 것을 의미하는 form-data를 보내는 방법을 정의합니다.
구문
다음은 구문입니다 -
<form method=”get | post”></form>
여기에서 얻으십시오. 양식 데이터를 URL 변수로 보내고 게시 양식 데이터를 HTTP 포스트 트랜잭션으로 보냅니다.
HTML Form 메소드 Attribute-
의 예를 살펴보겠습니다.예시
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
height: 100vh;
background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) no-repeat;
text-align: center;
}
input {
width: 315px;
display: block;
margin: 1rem auto;
border: 2px solid #fff;
padding: 8px;
background: transparent;
border-radius: 20px;
outline: none;
}
::placeholder {
color: #000;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 20px;
width: 330px;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem auto;
}
</style>
<body>
<h1>HTML Form method Attribute Demo</h1>
<form action="/action_page.php" method="get">
<input type="text" name="firstname" placeholder="Enter First Name">
<input type="text" name="lastname" placeholder="Enter Last Name">
<input type="submit" value="SUBMIT" class="btn">
</form>
</body>
</html> 출력

양식 세부 정보를 입력한 다음 "SUBMIT" 버튼을 사용하여 양식을 제출하여 method 속성이 어떻게 작동하는지 관찰하십시오.
