페이지

2012년 8월 19일 일요일

form send

<?
    $br = "<br>";
?>

<html>
<head><title>환경변수</title></head>
<body>
<?
    if($your_name && $your_phone){
        echo "{$your_name}님의 전화번호는 {$your_phone}입니다";
    }
   
?>
<!--
<form name = form action = "ex.php" method=post>
    post: 보내는 방식.보안에 좋음, get:보안에 않좋음.
-->

<!-- <form name = form action = "<?=$_SERVER[PHP_SELF]?>" method=post> -->
<form name = form method=post action = "ex2.html">
    <font face=굴림 size=2>
    이름 : <input type = "text" name = "your_name"> <br>
    전화 : <input type = "text" name = "your_phone"> <br>
    <input type="submit" value="send">
    </font>   
</form>


</body>
</html>


환경변수
PHP_SELF : 현 파일이름.
DOCUMENT_ROOT: 현파일의 절대경로
REMOTE_ADDR : 사용자의 IP주소

환경변수 사용시 $_SERVER 로 감싼다.
$_SERVER[REMOTE_ADDR]

댓글 없음:

댓글 쓰기