
1.html

成都創(chuàng)新互聯(lián)總部坐落于成都市區(qū),致力網(wǎng)站建設(shè)服務(wù)有網(wǎng)站建設(shè)、網(wǎng)站設(shè)計、網(wǎng)絡(luò)營銷策劃、網(wǎng)頁設(shè)計、網(wǎng)站維護、公眾號搭建、微信小程序、軟件開發(fā)等為企業(yè)提供一整套的信息化建設(shè)解決方案。創(chuàng)造真正意義上的網(wǎng)站建設(shè),為互聯(lián)網(wǎng)品牌在互動行銷領(lǐng)域創(chuàng)造價值而不懈努力!
內(nèi)容:
html
head
/head
body
form action="2.php" method="post"
input type="text" name="user" /
input type="submit" value="提交"
/form
/body
/html
2.php
內(nèi)容:
echo $_POST['user'];
可以用get傳,但是相對于的php頁面也要用$_GET 接收。
三中接受方式:
$_GET ? ?//get過來的數(shù)據(jù)
$_POST ?//post過來的數(shù)據(jù)
file_get_contents("php://input") ? //接口過來的xml等字符串數(shù)據(jù)用這個接
這三個方法足以接受任何數(shù)據(jù)了,具體你還要百度一下用法
PHP 可以通過POST、GET方法獲取到表單提交的數(shù)據(jù)
獲取到的POST、GET是數(shù)組形式的值,需要通過鍵值來詳細獲取相應(yīng)的值
比如: index.php 頁面
下面是POST方法
form name="form1" method="post" action="index.php"
input type="text" name="contents" value=""
input type="submit" value="提交"
/form
?php
//獲取表單提交的數(shù)據(jù)
$contents = $_POST['contents'];
echo $contents;
?
也可以是下面是GET方法
form name="form1" method="get" action="index.php"
input type="text" name="contents" value=""
input type="submit" value="提交"
/form
?php
//獲取表單提交的數(shù)據(jù)
$contents = $_GET['contents'];
echo $contents;
?
POST相對于GET方法,更好一些,可以提交大量數(shù)據(jù),以及更安全些。