20110418

PHP 與 HTML如何傳遞變數

1.用form傳遞 ,$_POST['NAME']變數
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title heretitle>
head>
<body>
//FORM method='post',按下submit後會切換到ootest.php
        //在php中以$_POST["name"]取得其值
         //ex:$_POST["studname"] 
        <form name="form1" method="post" action="ootest.php">
 <input type=text name="studname">
 <input type=submit name="submit" value="enter">
        form>
body>
html>
 
2. URL(http://url/xxx.php?欄位名稱=欄位值&...),$_GET["name"]變數 
<form name="form1" method="get" action="ootest.php">
 <input type=text name="studname">
 <input type=submit name="submit" value="enter">
        form>
3. $_SERVER $_COOKIE $_SESSION變數
 
 http://www.study-area.org/phorum/index.php?topic=32453.0;wap2
http://blog.yam.com/ihy08/article/17825438 

沒有留言: