conn.php
<?php
$link = mysql_connect("localhost","root"," ");
mysql_select_db("guestbook");
mysql_query("set names utf-8");
if(!$link){
die("Connection failed: " . mysqli_connect_error());
}
//echo "链接成功";
?>
result.php
<?php
error_reporting(0); //关闭NOTICE提示
require_once "conn.php";
$title = $_REQUEST['title'];
$username = $_REQUEST['username'];
$content = $_REQUEST['content'];
$content = str_replace("\n","<br>",str_replace(" "," ",$content)); //显示'空格'和'回车'
$week = '星期'.mb_substr( "日一二三四五六",date("w"),1,"utf-8" );
$isok =mysql_query("insert into guestlist(title,username,content,addtime)values('$title','$username','$content','".date("Y-m-d H:i:s")." $week ')");
if($isok)
{
echo "<script>
alert('提交成功');
location.href='index.php';
</script>";
}else {
echo "<script>
alert('提交失败');
location.href='index.php';
</script>";
}
?>
css/index.css
body{margin:0;padding:0;}
ul,li{list-style: none;margin:0;padding:0;}
a{text-decoration: none;}
.content{
width:800px;
margin:0 auto;
}
.bt{
width:799px;
height:20px;
text-align: center;
background:#EB9316;
margin:0 0 5px 0;
}
.bt>li{
float:left;
width:265px;
height:20px;
text-align: center;
line-height: 20px;
font-size:13px;
}
.nr{
float:left; /*如果不浮动 后面的lynr会受影响*/
width:799px;
height:20px;
text-align: center;
background:#B9DEF0;
}
.nr>li{
float:left;
width:265px;
height:20px;
text-align: center;
line-height: 20px;
font-size:13px;
}
.lynr{
float:left; /*如果不浮动会 布局会乱*/
width:800px;
margin:1px 0 1px 0;
}
.content p{
width:70px;
height:50px;
float:left;
}
.content span{
display: block;
width:710px;
float:left;
}
td{
width:80px;
padding:5px 0;
/*border: 1px solid #79ABFE;*/
}
td input,textarea{
border: 1px solid #79ABFE;
}
/*tr{
display:block; /*将tr设置为块体元素 显示块状后 就将其包围住了 不是一个矩形了
}*/
dist/css/bootstrap.min.css(自己下载)
效果图:


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
PHP有序表查找之插值查找算法示例这篇文章主要介绍了PHP有序表查找之插值查找算法,简单分析了插值查找算法的概念、原理并结合实例形式分析了php实
ThinkPHP整合datatables实现服务端分页的示例代码下面小编就为大家分享一篇ThinkPHP整合datatables实现服务端分页的示例代码,具有很好的参考价值,希望对大家有所帮
PHP实现APP微信支付的实例讲解下面小编就为大家分享一篇PHP实现APP微信支付的实例讲解,具有很好的参考价值,希望对大家有所帮助。一起跟随小
PHP实现的多维数组排序算法分析这篇文章主要介绍了PHP实现的多维数组排序算法,结合实例形式对比分析了php针对多维数组及带有键名的多维数组进行
php+ajax实现无刷新文件上传功能(ajaxuploadfile)这篇文章主要为大家详细介绍了php结合ajaxuploadfile实现无刷新文件上传功能,具有一定的参考价值,感兴趣的小伙伴们
PHP的RSA加密解密方法以及开发接口使用本篇文章给大家详细介绍了PHP开发接口使用RSA进行加密解密方法,对此有兴趣的朋友可以学习下。