Home >Backend Development >PHP Tutorial >php基础教程--学习总结

php基础教程--学习总结

WBOY
WBOYOriginal
2016-06-23 13:41:37946browse

一、php和表单

1.POST方法手动发送数据:

二者部分区别:

GET:

1.将信息聚集起来作为URL一部分传送

2.传送数量有限

3.公开传送,诸如密码信息会暴露

4.创建的表单可以添加为书签。

POST:

1.传递的信息用户看不到


用法示例:

html文件:ws.html

   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title><base>  <div id="awindow">
<form action="handle.php" method="post"> <p> Name:<select name="title"> <option value="Mr">Mr</option> </select> <input type="text" name="name" size="20"></p> <input type="submit" value="send">
</form>    <br> php文件:handle.php  <br>  <p></p>  <p></p>  <pre name="code" class="sycode">   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title><base>   <div id="awindow">
<?phpini_set ('display_errors', 1);error_reporting(E_ALL|E_STRICT);<strong><span style="color:#ff0000;">$title=$_POST['title'];$name =$_POST['name'];</span>print "<p> hello <span style="color:#ff0000;">$title $name</span>";?>  输入:myname  </p>
<p></p>  <p>结果:hello Mr myname</p>  <p>2.GET传送数据<br> <br> </p>  <p></p>  <pre name="code" class="sycode">   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title><base>  <div id="awindow">
<ul> <li><a href="<strong"><span style="color:#ff0000;">"handle.php?name=Charles</span>">Charles</a></li>
</ul>     <br> php文件:handle.php  <p></p>  <p></p>  <pre name="code" class="sycode">   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title><base>   <div id="awindow">
<?phpini_set ('display_errors', 1);error_reporting(E_ALL|E_STRICT);<strong><span style="color:#ff0000;">$name=$_GET['name'];print "<p> hello $name";</p></span>?>    <br>  <br>  <p></p> </div>
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
Previous article:手机端支付宝和pc端有区别吗?只要申请开通权限一样用吗?Next article:PHP 弹出保存对话框

Related articles

See more