Html与PHP的简单通信

之前帮同学做了简单的数据分析,使用了Python的Pandans模块,加上使用函数清洗了数据,其实主要原因是,我真的不会Excel处理复杂数据,个人认为还不如编程来的直接。还好通过一段时间的努力,总算兑现了一月份之前搞定的诺言。
        最近开始学习php。那么最基础的就是html和php的简单通信,也就是表单的处理。网上的教程和图灵的书籍,入门第一章都是语法基础,紧接着就是php获取表单数据。看来,这真的是第一步。
        环境:OS10.10,phpstorm,xampp。
        调试时候花了大量时间在phpstorm的配置,后来发现,必须得把php工程放在xampp文件夹的htdoc里面,才能成功调试,DW没试过,总之,如果用自己机器学习的话,这些应该足够了吧。代码来自图灵兔子书PHP与MySql动态网站开发LarryUllman写的。

        Html部分:
         
<!DOCTYPE  html >
<html>
<head>
<meta  http-equiv= "content-type"  content= "text/html; charset=utf-8"  />
<title> TTY </title>
<style  type= "text/css"  title= "text/css"  media= "all" >
label  {
font-weight : bold ;
color : blue ;
}
</style>
</head>
<body>
<form  action= "pro.php"  method= "post"  target= "_self" >
<fieldset>
<legend>
请输入信息:
</legend>
<p><label> Name: <input  type= "text"  name= "name"  size= "20"  maxlength= "40"  /></label></p>
<p><label> Email地址: <input  type= "text"  name= "email"  size= "40"  maxlength= "60"  /> </label></p>
<p><label  for= "gender" > Gender: </label><input  type= "radio"  name= "gender"  value= "M"  /> Male
<input  type= "radio"  name= "gender"  value= "F"  /> Female </p>

<p><label> Age:
<select  name= "age" >
<option  value= "0-29" > 30以下 </option>
<option  value= "30-60" > 30-60 </option>
<option  value= "60+" > 60以上 </option>
</select>
</label></p>

<p><label> 内容: <textarea  name= "comments"  rows= "3"  cols= "40" ></textarea> </label></p>
</fieldset>

<p  align= "center" ><input  type= "submit"  name= "submit"  value= "提交我的信息"  /></p>

</form>
</body>
</html>

        PHP文件:
         
<!DOCTYPE  html > <html>
<head>
<meta  charset= "UTF-8" >
<title> 表单回调测试 </title>
</head>

<body>

<?php

$name  $_POST [ 'name' ] ;
$email  $_POST [ 'email' ] ;
$comment  $_POST [ 'comments' ] ;

echo  "<p>非常感谢! <b> $name </b>
您写了以下建议:<br/>
$comment </p>
<p>我们将会回复邮件到您的email地址:,<i> $email </i></p>" ;

?>

</body>


参考:http://www.cnblogs.com/vincent_ds/archive/2012/11/09/2761900.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

limaning

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值