한줄 입력시 <input type = "text">

여러줄 입력시 <textarea></textarea>

입력값을 전송시 <input type="submit">

전송하려면 전송할 주소가 필요함

<form action="http://localhost:3000/process_create">
<p><input type="text"></p>
<p>
<textarea></textarea></p>
<p>
<input type="submit">
</p>
</form>

이렇게 해주면 위의 주소로 전송이 된다

 

입력하는 input값들이 이름이 필요

<input type="text" name="title">

<textarea name="description"></textarea>

 

이렇게 작성하고 submit을 누르면 http://localhost:3000/process_create?title=hi&description=url 이런 형태로 나온다

 

이는 적은 내용들이 다 노출이 되기 때문에 좋은 방법이 아니다

 

<form action="http://localhost:3000/process_create" method="post">

method값을 post로 줘보자

 

http://localhost:3000/process_create 이렇게 뜸을 알 수 있다 즉 작성한 내용들이 감춰진다

 

method 값은 post방식과 get방식이 있는데 생략하면 get방식이 사용된다

 

서버의 자료를 수정 삭제 생성할 경우에는 method를 post방식을 사용해야 한다

'휴지통 > Node.Js' 카테고리의 다른 글

공부(16)  (0) 2021.08.25
공부(15)  (0) 2021.08.25
공부(13)  (0) 2021.08.25
공부(12)  (0) 2021.08.25
공부(11)  (0) 2021.08.25

+ Recent posts