我写的这个PHP有没什么错误吗?写的目的,从一个HTML表单接受数据,然后连接数据库然后创建一个数据库
<head><metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/><title>无标题文档</...
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
if($dbc=mysql_connect('localhost','bolg','123456'))
{
if(mysql_query('CREATE DATABASE $name',$dbc))
{
print "Congratulations on your successful registration, please click the enter belong to your heavy taste blog";
}
else
{ print "Congratulations on your registration failed, please contact GuoQiJun";
}
mysql_close($dbc);
}
else
{
print "I'm sorry, the user name$name has been registered, please take another name!";
}
?>
</body>
</html> 展开
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
if($dbc=mysql_connect('localhost','bolg','123456'))
{
if(mysql_query('CREATE DATABASE $name',$dbc))
{
print "Congratulations on your successful registration, please click the enter belong to your heavy taste blog";
}
else
{ print "Congratulations on your registration failed, please contact GuoQiJun";
}
mysql_close($dbc);
}
else
{
print "I'm sorry, the user name$name has been registered, please take another name!";
}
?>
</body>
</html> 展开
2个回答
展开全部
直接用一个php页面
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
if($dbc=mysql_connect('localhost','bolg','123456'))
{
if(mysql_query('CREATE DATABASE $name',$dbc))
{
print "Congratulations on your successful registration, please click the enter belong to your heavy taste blog";
}
else
{ print "Congratulations on your registration failed, please contact GuoQiJun";
}
mysql_close($dbc);
}
else
{
print "I'm sorry, the user name$name has been registered, please take another name!";
}
?>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
if($dbc=mysql_connect('localhost','bolg','123456'))
{
if(mysql_query('CREATE DATABASE $name',$dbc))
{
print "Congratulations on your successful registration, please click the enter belong to your heavy taste blog";
}
else
{ print "Congratulations on your registration failed, please contact GuoQiJun";
}
mysql_close($dbc);
}
else
{
print "I'm sorry, the user name$name has been registered, please take another name!";
}
?>
更多追问追答
追问
弱弱的问,MVC框架是不是把视图和控制分开来呀?于是我这样分开来了,这样理解有没有错?
追答
视图是用来渲染页面的,控制器是用来生成数据的。只要做到渲染页面时,不需要改动生成数据模块的代码就可以了
2013-02-16
展开全部
写有太不规范 不想往下看了
追问
我是超级新人啊,为什么我用HTML表单页面提交后,PHP页面怎么接受不了POST 的数据的?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询