개발자의 길/Web Programming
<HTML> 데이터 보내기(GET/POST)
모쿠
2017. 3. 29. 14:41
<입력한 ID, PW값 넘겨주기>
- form : 데이터를 보낼 패키지를 입력하는 태그(form안에서만 아래 기능이 실행됨)
- action: 사용자가 보낼 주소
- method: 보내는 방식
- GET 방식: 사용자가 입력한 데이터를 URL 주소와 함께 서버로 전송하는 방식
- POST 방식: 사용자가 입력한 데이터를 요청 패킷(request packet)의 body에 포함시켜서 외부에 노출이 되지 않도록 전송하는 방식
- type : 문자열 입력 형식
- name : 변수이름
<12_method.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 | <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Method</title> </head> <body> <h1>GET/ POST 방식</h1> <!-- 옛날 방식 --> <form action="result.html" method="post"> 아이디<br/> <input type="text" name="userid"/> <br/> 비밀번호<br/> <input type="password" name="passwd" /> <br/> <input type="submit" value="로그인" /> <input type="reset" value="취소" /> </form> <hr/> <!-- 요즘 방식 --> <form action="result.html" method="post"> <input type="text" name="userid" placeholder="아이디 입력"/><br/><br/> <input type="password" name="passwd" placeholder="패스워드 입력"/><br/><br/> <input type="submit" value="로그인" /> <input type="reset" value="취소" /> </form> </body> </html> | cs |
<result.html>
1 2 3 4 5 6 7 8 9 10 | <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <h1>로그인 결과 페이지</h1> </body> </html> | cs |