第一个留言板

来源:互联网 发布:安卓编程入门 编辑:程序博客网 时间:2024/05/01 08:42
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gbk" /><title>留言板</title></head><body><table width="678" align="center"><tr><td colspan="2"><h1>留言本</h1></td></tr><tr><td width="586"><a href="index.php">首页</a> | <a href="zhu.html">留言</a></td></tr></table><table align="center" width="678"><tr><td><form name="form1" method="post" action="post.php"><p>Name:<input name="name" type="text" id="name"></p><p>Email:<input type="test" name="email" id="email"></p><p>留言:</p><p></p><p><input type="submit" name="button" id="button" value="提交"><input type="reset" name="button2" id="button2" value="重置"></p></form></td></tr></table></body></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>无标题文档</title></head><body><?php include("confg.php"); $sq="SELECT * FROM `content`"; $res=mysql_query($sq); while($row=mysql_fetch_array($res)){ echo $row[0]; }?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gbk" /><title>无标题文档</title></head><body><?phpecho "post";//header("content-Type: text/html; charset=utf-8");include("confg.php");$name= $_POST['name'];echo $name;$email= $_POST['email'];echo $email;$sql = "insert into content (name,email) values ('$name','$email')";mysql_query($sql);?></body></html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gbk" /><title>无标题文档</title></head><body><?php $q=mysql_connect("localhost","root",""); if(!$q) { die ('不能连接数据库。'.mysql_erro()); } else echo "成功";  mysql_query("set names utf8");  mysql_select_db("mysql",$q);?></body></html>