ํผ(form) ํƒœ๊ทธ

๐Ÿ“„ ํผ(form) ํƒœ๊ทธ

form์€ ์ž…๋ ฅ ์š”์†Œ๋ฅผ ๊ฐ์‹ธ๋ฉฐ ์ž…๋ ฅ ๊ฐ’์„ ์„œ๋ฒ„ ์ธก์œผ๋กœ ์ œ์ถœํ•ฉ๋‹ˆ๋‹ค.
์ž…๋ ฅ๊ฐ’์„ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„๋กœ ์ „์†กํ•˜๋ฉด ์„œ๋ฒ„ ์ธก์—์„œ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ฒ˜๋ฆฌํ•œ ๊ฒฐ๊ณผ๋ฅผ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋ณด๋‚ด์ค๋‹ˆ๋‹ค.

๐Ÿ“„ ํผ(form)ํƒœ๊ทธ์˜ ์†์„ฑ

  1. action: ์ž…๋ ฅ๊ฐ’์„ ์ „์†กํ•  ์„œ๋ฒ„์˜ url
  2. method: ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ž…๋ ฅํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์–ด๋–ค ์‹์œผ๋กœ ์ „์†กํ•  ๋ฐฉ๋ฒ•(GET or POST)
<form action="example.php" method=:"POST">
    <input type="submit" value="์ „์†ก">
</form>

GET: ์„œ๋ฒ„๋กœ ์š”์ฒญ์„ ๋ณด๋‚ด ์‘๋‹ต์„ ๋ฐ›์•„๋ƒ…๋‹ˆ๋‹ค. POST: ์„œ๋ฒ„์— ์š”์ฒญ์„ ๋ณด๋‚ด์–ด ์„œ๋ฒ„์— ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”๊ฐ€/์ˆ˜์ •/์‚ญ์ œํ•œ ํ›„์— ์‘๋‹ต์„ ๋ฐ›์•„๋ƒ…๋‹ˆ๋‹ค.

Leave a comment