Home >Backend Development >PHP Tutorial >一个容易示例来演示用PHP访问表单变量

一个容易示例来演示用PHP访问表单变量

WBOY
WBOYOriginal
2016-06-13 12:23:46856browse

一个简单示例来演示用PHP访问表单变量

首先编写表单页面orderform.html,用post方法请求服务端脚本文件:processorder.php

orderform.html:

    <meta charset="UTF-8">    <title>订单页面</title><h2>Jason的购物清单</h2>

processorder.php:

    <meta charset="UTF-8">    <title>订单结果</title><h1>Jason的购物车</h1><h2>订单结果</h2><?php $cloths=$_POST[&#39;cloths&#39;];    $shoes=$_POST[&#39;shoes&#39;];    $glasses=$_POST[&#39;glasses&#39;];    echo &#39;<p>订单提交中时间:';    //设置时区    date_default_timezone_set('Asia/Shanghai');    //按指定格式输出数据    echo date('Y-m-d H:i');    echo '';    echo '<p>您的具体购物清单是:</p>';    echo $cloths.'件男装<br>';    echo $shoes.'双鞋子<br>';    echo $glasses.'副眼镜';?>



版权声明:本文为博主原创文章,未经博主允许不得转载。

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