 |
|
|  |
| $ REQUEST - GET방식,POST방식 구분하지 않고 값 받기 |
|
|
 |
12년 전 |
$_REQUEST 변수
-> 사용자가 GET방식이든 POST방식이든지 상관없이 변수의 데이터를 값으로 받는다.
[예제]
---------------------------------------------------------------------------------------
test1.html
<form name=userinfo method=GET action="test2.html" >
아이디 <input name=userid type=text size=19>
<input type=submit value="클릭">
</form>
test11.html
<form name=passwd method=POST action="test2.html">
비밀번호<input name=pass type=password size=19>
<input type=submit value="클릭">
</form>
test2.html
<?php
echo "결과화면";
$var1 = $_GET["userid"];
$var2 = $_POST[pass];
echo "<br>아이디 : $var1";
echo "<br>비밀번호 : $var2 ";
?>
test3.html
<?php
echo "결과화면";
$var1 = $_REQUEST["userid"];
$var2 = $_REQUEST[pass];
echo "<br>아이디 : $var1";
echo "<br>비밀번호 : $var2 ";
?>
-----------------------------------------------------------------------------------------
보통 test2.html으로 보내서 값을 받지만, test3.html으로 보내서 모두다 $_REQUEST 변수로 받을수 있다.
|
|
추천 : 599 |
추천
목록
|
|
|  |
|