php学习练手(一)
来源:互联网 发布:婚纱照一键修图软件 编辑:程序博客网 时间:2024/05/17 22:13
学习目的
将form.php中html内form表单内容提交到handle_form.php中,最终显示出来。
代码
form.php:
<?php?><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title></head><style type="text/css" title="text/css" media="all"> label{font-weight: bold; color: #300ACC;}</style><body><!--Script 2.1 -form.html--> <form action="handle_form.php" method="post"> <fieldset> <legend>Enter your information in the form below:</legend> <p><label>Name:<input type="text" name="name" class="name" /></label></p> <p><label>Email Adress: <input type="text" name="email" class="email" /></label></p> <p>Gender:<input type="radio" name="gender" id="M" /><label for="male">Male</label><input type="radio" name="gender" id="F" /><label for="female">Female</label></p> <p><label>Age:<select> <option value="0-29">Under 30</option> <option value="30-60">Between 30 and 60</option> <option value="60+">Over 60</option> </select></label></p> <p><label>Comments: <textarea name="comments" rows="3" cols="40"></textarea></label></p> </fieldset> <p align="center"><input type="submit" name="submit" value="Submit My Information" /></p> </form></body></html>
handle_form.php:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title></head><body> <?php #Script 2.2 - handle_form.php $name = $_REQUEST['name']; $email = $_REQUEST['email']; $comments = $_REQUEST['comments']; echo "<p>Thank you, <b>$name</b>,for the following comments:<br/> <tt>$comments</tt></p> <p>We reply to you at <i>$email</i></p>"; ?></body></html>
结果
form.php:
handle_form.php:
知识点总结
重要html标签:fieldset,select
php超全局变量:$_REQUEST——它存储了通过GET或POST方式发送到php页面的所有数据,以及在cookie中可访问的数据。与 $_GET方式或$_POST相比,其速度较慢。$_GET方式获取浏览器的GET方式传递的数据,在url中可见,安全性差,且数据传送量小,不大于2kB。$_POST方式获取浏览器通过POST方式传递的数据,安全性较高。
0 0
- php学习练手(一)
- php学习练手(二)
- PHP学习练手(三)
- PHP学习练手(四)
- PHP学习练手(五)
- PHP学习练手(六)
- PHP学习练手(七)
- PHP学习练手(八)
- PHP学习练手(九)
- PHP学习练手(十)
- PHP学习练手(十一)
- PHP学习练手(十二)
- PHP学习练手(十三)
- PHP学习练手(十四)
- PHP学习练手(十五)
- PHP学习练手(十六)
- Python练手(一)
- 练手小程序(一)
- Learning Python(4)--错误处理
- 集算器序表和SQL数据表的异同
- java注解基础
- Android之的Shape图形使用
- ECSHOP模板制作中常见循环的操作方法
- php学习练手(一)
- PHP、MySql乱码解决方案
- ios触摸事件二 :事件传递
- SSH、myBatis下载地址
- 运维角度浅谈MySQL数据库优化
- dede:arclist 不能调用文章的副栏目或多个副栏目的解决方法
- JQuery移除事件
- 底层
- VS2013 C++ error C1083: 无法打开源文件: “SDKDDKVer.h”, "stdio.h", "tchar.h"