Loading [MathJax]/jax/output/HTML-CSS/jax.js

html에서 전달된 인자가 php로 넘어갈 때 동작 방식

POST 방식

  • 전달받은 인자가 URL 상에 노출되지 않음

post.html

<html>

<head />

<body>

    <FORM method="post" action="post_receive.php">
        아이디 : <input type="text" name="userID" />
        이름 : <input type="text" name="userName" />
        <br />
        <input type="submit" value="전송" />
    </FORM>

<body>

</html>

 

post_receive.php

<?php
header('Content-Type: text/html charset=utf-8');
userID=_POST["userID"];
userName=_POST['userName'];

echo "전달받은 ID : userID<br>";echo":userName <br>";
?>

전달된 인자 확인 불가능

GET 방식

  • 전달받은 인자가 URL 상에 노출됨 -> 보안상 좋지 않음

get.html

<html>

<head />

<body>

    <FORM method="get" action="get_receive.php">
        아이디 : <input type="text" name="userID" />
        이름 : <input type="text" name="userName" />
        <br />
        <input type="submit" value="전송" />
    </FORM>

<body>

</html>

 

get_receive.php

<?php
header('Content-Type: text/html charset=utf-8');
userID=_GET["userID"];
userName=_GET['userName'];

echo "전달받은 ID : userID1<br>";echo":userName 1<br>";
?>

전달된 인자를 확인 가능