PHP ????: $_GET ? $_POST
$_GET ??
?? ??? $_GET ??? method="get"? ???? ???? ?? ???? ? ?????.
GET ???? ???? ???? ??? ??? ?? ??? ? ? ???(????? ?? ???? ???) ???? ??? ??? ??? ????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> get </title> </head> <body> <form method="get" action="name.php"> 用戶名:<input type="text" placeholder="請輸入用戶名" name="name"><br> 密 碼:<input type="password" placeholder="請輸入密碼" name="pwd"><br> <input type="submit" value="提交"><br> </form> </body> </html>
???? ?? ??? ??? name.php ??? ????
<?php
$name = $_GET['name' ];
$pwd = $_GET['pwd'];
?>
??? ?? ??? ??? ??? ?? ???? ?? ??? ???. : get ???? ???? ???? ??? ??? ?? ???? ?????
?? ?? post ???? ???? ?????
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> get </title> </head> <body> <form method="post" action="name.php"> 用戶名:<input type="text" placeholder="請輸入用戶名" name="name"><br> 密 碼:<input type="password" placeholder="請輸入密碼" name="pwd"><br> <input type="submit" value="提交"><br> </form> </body> </html>
post ??? ?? ??? ??? ????
<?php
$name = $_POST['name'];
$pwd = $_POST['pwd'];
?> ??>
?? ???? ??? ??? ???? name.php? ???? ???. ?? ???? ?? ??? ?????. post ??? ???? ?? ???? ??? ???? ????. ??? ???? ????. ??: ? ? ??? ?? ??? ?? ? ?? ??? ??? ???? ?? ?? ??? ???? ???.