Head First PHP&MySQl第一章代码
HTML:
<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title>外星人绑架了我--报道一起绑架</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h2>外星人绑架了我--报道一起绑架</h2> <p>分享你的关于被外星人绑架的故事:</p>
<form method="post" action="report.php">
<label for="name">名字:</label>
<input type="text" id="tname" name="name" /><br /> <label for="email">邮箱地址:</label>
<input type="text" id="email" name="email" /><br /> <label for="whenithappened">发生的时间:</label>
<input type="text" id="whenithappened" name="whenithappened" /><br /> <label for="howlong">你消失了多久:</label>
<input type="text" id="howlong" name="howlong" /><br /> <label for="howmany">你看见多少多少外星人:</label>
<input type="text" id="howmany" name="howmany" /><br /> <label for="aliendescription">描述一下它们:</label>
<input type="text" id="aliendescription" name="aliendescription" size="32" /><br /> <label for="whattheydid">他们对你做了什么:</label>
<input type="text" id="whattheydid" name="whattheydid" size="32" /><br /> <label for="fangspotted">你看见过我的狗Fang吗?</label>
见过 <input id="fangspotted" name="fangspotted" type="radio" value="见过" />
没有 <input id="fangspotted" name="fangspotted" type="radio" value="没有" /><br /> <img src="fang.jpg" width="100" height="175"
alt="My abducted dog Fang." /><br /> <label for="other">如果您还有其他的要说可以在这里写下:</label>
<textarea id="other" name="other"></textarea><br /> <input type="submit" value="提交" name="submit" />
</form>
</body>
</html>
CSS:
form label {
display: inline-block;
width: 225px;
font-weight: bold;
}
PHP:
<html>
<head>
<title>外星人绑架了我--报道一起绑架</title>
</head> <body>
<h2>外星人绑架了我--报道一起绑架</h2> <?php
$name = $_POST['name'];
$when_it_happened = $_POST['whenithappened'];
$how_long = $_POST['howlong'];
$how_many = $_POST['howmany'];
$alien_description = $_POST['aliendescription'];
$what_they_did = $_POST['whattheydid'];
$fang_spotted = $_POST['fangspotted'];
$email = $_POST['email'];
$other = $_POST['other']; $to = '**********@**.com';
$subject = '外星人绑架了我--报道一起绑架';
$msg = "$name 被绑架了在 $when_it_happened 并且持续了 $how_long.\n" .
"外星人的数量: $how_many\n" .
"外星人的外貌: $alien_description\n" .
"它们做了什么: $what_they_did\n" .
"Fang是否被看见: $fang_spotted\n" .
"其他内容: $other";
//需要安装sendmail才可以使用mail()函数
mail($to, $subject, $msg, 'From:' . $email); echo '非常感谢你提交的表单.<br/>';
echo '你在什么时候被绑架的?'.$when_it_happened.'<br/>';
echo '你被带走了多长时间? '.$how_long.'<br/>';
echo '外星人的数量是多少? '.$how_many.'<br/>';
echo '外星人的外貌是什么样? '.$alien_description.'<br/>';
echo '外星人做了什么? '.$what_they_did.'<br/>';
echo 'Fang在不在那里? '.$fang_spotted.'<br/>';
echo '其它内容: '.$other.'<br/>';
echo '你的邮箱地址是: '.$email.'<br/>';
?>
</body>
</html>
Head First PHP&MySQl第一章代码的更多相关文章
- 高性能MySQL——第一章MySQL的架构与历史
1.可以使用SHOW TABLE STATUS查询表的相关信息. 2.默认存储引擎是InnoDB,如果没有什么很特殊的要求,InnoDB引擎是我们最好的选择. 3.mysql的infobright引擎 ...
- Head First PHP&MySQl第二章代码
PHP: <html> <head> <title>外星人绑架了我--报道一起绑架</title> </head> <body> ...
- SQL COOKBOOK SQL经典实例代码 笔记第一章代码
-- SQL COOKBOOK CHAPTER1 -- 查看所有内容 select * from emp; -- 可以单列 select empno,ename,job,sal,mgr,hiredat ...
- 第一章 数据库概述、MySQL的安装和配置
第一章 数据库概述.MySQL的安装和配置 1.为什么要使用数据库 最早是纸质文件来存储数据 缺点:不易保存,占用空间大 计算机出现以后,采用软件来进行保存(excel) 缺点:容易损坏 文件 ...
- 《Mysql 公司职员学习篇》 第一章 小A的烦恼
第一章 小A的烦恼 ----- 为什么学习数据库 和 如何选择数据库 小A是某公司的职员,公司数据部的员工,平常的大小工作,完全离不开EXCELL,而最近小A却越来越苦恼,不由的向好朋友小Y吐槽.小 ...
- 编写高质量代码:改善Java程序的151个建议(第一章:JAVA开发中通用的方法和准则)
编写高质量代码:改善Java程序的151个建议(第一章:JAVA开发中通用的方法和准则) 目录 建议1: 不要在常量和变量中出现易混淆的字母 建议2: 莫让常量蜕变成变量 建议3: 三元操作符的类型务 ...
- Mysql必知必会 第一章 了解SQL
第一章 了解SQL 1.1 数据库基础 1.1.1 什么是数据库 数据库的定义:保存有组织的数据的容器 数据库软件不是数据库,而是DBMS 1.1.2 表 表(Table)的定义:某种特定类型数据的结 ...
- 20172327 2018-2019-1 《第一行代码Android》第二章学习总结
学号 2017-2018-2 <第一行代码Android>第二章学习总结 教材学习内容总结 - 活动是什么: 活动(Activity)是最容易吸引用户的地方,它是一种可以包含用户界面的组件 ...
- 20172327 2018-2019-1 《第一行代码Android》第一章学习总结
学号 2018-2019-1 <第一行代码Android>第一章学习总结 教材学习内容总结 - Android系统架构: 1.Linux内核层 Android系统是基于Linux内核的,这 ...
随机推荐
- VLC和Qt结合编写流媒体rtsp播放器
VLC播放器是一款功能强大且小巧的播放器,它支持多种多样的音视频格式,比如MPEG1,2以及mp3等等.并且通过Qt和VLC的结合能让每个开发者写出自己的视频流媒体播放器. Q ...
- CentOS6 Zabbix-Agent2.0安装脚本
#! /bin/bash ##################################### #-----------------------------------# #------zabb ...
- DFA和NFA的区别
正则表达式引擎分成两类,一类称为DFA(确定性有穷自动机),另一类称为NFA(非确定性有穷自动机).两类引擎要顺利工作,都必须有一个正则式和一个文本串,一个捏在手里,一个吃下去.DFA捏着文本串去比较 ...
- layui 表单遇到的小问题
select中的option 居中显示 /*select显示的option居中*/ /*.layui-select-title input{ text-align: center; }*/ /*opt ...
- 图片加载框架之Glide和Picasso
Glide介绍 Glide是一个加载图片的库,作者是bumptech,它是在泰国举行的google 开发者论坛上google为我们介绍的,这个库被广泛的运用在google的开源项目中. Glide是一 ...
- function $(id) { return typeof id === "string" ? document.getElementById(id) : id; }
function $(id) { return typeof id === "string" ? document.getElementById(id) : id; } 这句代 ...
- JndiObjectFactoryBean 配置数据源
转: JndiObjectFactoryBean 配置数据源 2017年08月29日 22:04:28 病毒先生 阅读数:7338 版权声明:本文为博主原创文章,未经博主允许不得转载. https ...
- 小D课堂 - 零基础入门SpringBoot2.X到实战_第11节 Logback日志框架介绍和SpringBoot整合实战_45、SpringBoot2.x日志讲解和Logback配置实战
笔记 2.SpringBoot2.x日志讲解和自定义Logback配置实战 简介:讲解SpringBoot2.x整合Logback配置实战 1.官网介绍:https://docs.spring ...
- 使用shiro遇到的问题
Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException 解决问题:缺少一个依赖的缓存jar 添加: <d ...
- Debian系统软件安装
查看已安装软件 dpkg -l | grep -i name apt-get remove name 建议用root安装,有一些工具,使用非root用户安装后,仍然不识别命令,可能跟权限有关. net ...