이전 목록 다음
채택완료

form 관련 질문입니다.

page1.php

Copy
<!doctype html>

<html>

    <head>

        <meta charset="utf-8">

        <title>Form Test</title>

    </head>

    <body>

        <form name="ftest" id="ftest" action="./page2.php">

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

            <iframe src="./form.html">Loading...</iframe>

            <input type="submit" value="asdf">

        </form>

    </body>

</html>

 

form.html

Copy
<!doctype html>

<html>

    <head>

        <meta charset="utf-8">

    </head>

    <body>

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

    </body>

</html>

 

위와 같이 구성했을때, page1.php에서 폼을 제출하면 page2.php로 갔을때 f_attr2 변수가 포함되도록 할 수 있나요?

|

답변 3개 / 댓글 1개

채택된 답변
+20 포인트

form.html

Copy
<?php

$f_attr2 = $_REQUEST["f_attr2"];

?>


<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <input type="text" name="f_attr2" value="<?php echo $f_attr2; ?>">
    </body>
</html>

답변에 대한 댓글 1개

무슨원리로 돌아가는 건지 궁금한데...

Form 이라는건 다른 페이지로 값을 전달하는거에요. 그렇게 전달하면 리퀘스트 , 겟, 포스트로 전달 받을 수 있다고 약속이 정해진거에요. 이건 그냥 규

칙이자 모두의 약속이에요.

답변을 작성하려면 로그인이 필요합니다.