Home >php教程 >php手册 >php页面 表单传递参数实例教程

php页面 表单传递参数实例教程

WBOY
WBOYOriginal
2016-05-25 16:46:061041browse

在php中要传递参数有几种方法,今天我们就讲关于post get二种方法,post用得最多的是利用表单来传参数,get参数一般是url传值居多,下面我们举了二款实例.

post表单传递参数,代码如下:

<html>  
    <head>  
    </head>  
    <body>  
    <h3>search</h3>  
    <form action="c.php" method="post">  
    depart name:<input type="text" size=25 name="depart" value=""><br><br>  
    <input type="submit" name="submit" value="search">  
    </form>  
    </body>  
</html>

c.php页面,代码如下:

<?php  
    $depart=$_post["depart"];  
    $q = "select * from info where depart=&#39;$depart&#39;";  
?>

实例二get 方法传递参数,代码如下:

<a href="http://www.phprm.com/a.php?value=www.phprm.com">传get参数传</a>

a.php页面代码,代码如下:echo $_get['value']; 


文章网址:

随意转载^^但请附上教程地址。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn