我正在使用PHP,HTML和CSS代码进行项目。问题是当我在没有CSS代码的情况下执行它时,它可以工作,但是当我向其中添加CSS时,消息“成功创建”将显示在网页底部的状态栏中!为什么会发生这种情况,为什么不将其显示在页面上?
这是我的HTML代码:
<div class="bg">
<p><a href = "register.php">Register</a> | <a href="login.php">Login</a></p>
<h3>Registration Form</h3>
<form action="register.php" method = "POST">
Email: <input type = "text" name = "email"><br />
Username: <input type = "text" name = "user"><br />
Password: <input type = "password" name = "pass"><br />
<input type = "submit" value = "Login" name = "submit" />
</form>
</div>
这是我的PHP代码:
if (isset($_POST["submit"])) {
$email = $_POST['email'];
$user = $_POST['user'];
$pass = $_POST['pass'];
$connection = mysqli_connect('localhost' , 'root' , '', 'website') or die(mysqli_error());
mysqli_select_db($connection , "website") or die("can not select database");
if ($connection) {
$query = mysqli_query($connection ,"SELECT * FROM users WHERE username = '".$user."'");
$numOfRows = mysqli_num_rows($query);
if ($numOfRows == 0){
$sql = "INSERT INTO users( email ,username , password) VALUES('$email', '$user' , '$pass')";
$result = mysqli_query($connection , $sql);
if($result) {
echo "successfully Created";
} else {
echo "failure!";
}
} else {
echo "Username already exist!";
}
} else {
echo "can not connect to database";
}
}
这是我的CSS代码:
body, html {
height: 100%;
margin: 0;
}
.bg {
background-image: url("SARV.jpg");
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
答案 0 :(得分:0)
因为您以纯文本形式回显而不是将其处理为html代码。看看您的输出html。