これがお役に立てば幸いです。ヘッダーの場所を使用するWebページを作成しました。何か間違ったことをしたかどうかを確認できるかもしれません:
<html>
<head>
<link rel="stylesheet" type="text/css" href="./static/css/mobile-login.css">
<!-- <link rel="stylesheet" type="text/css" href="./static/css/mobile.css"> -->
<script>
function goBack()
{
window.history.back()
}
</script>
<title>Register | Mobile</title>
</head>
<body background="../images/mobile/login-bkg.jpg">
<center>
<a href="https://localhost/m/">
<img src="../static/images/logo.png">
</a>
</center>
<div id="login-panel" class="panel">
<div class="panel-container">
<?php
// Create connection
$con=mysqli_connect("localhost","root","","twitter");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$email = isset($_POST['email'])?( strtolower(trim($_POST['email'])) ):'';
$fullname = isset($_POST['name'])?(trim($_POST['name'])):'';
$username = isset($_POST['username'])?(trim($_POST['username'])):'';
$password2 = isset($_POST['password2'])?(trim($_POST['password2'])):'';
$password = isset($_POST['password'])?(trim($_POST['password'])):'';
$accept_terms = isset($_POST['accept_terms'])&&$_POST['accept_terms']==1;
// Check for duplicate entries
$result = mysqli_query($con, "SELECT * FROM users WHERE email='$email'");
if($result) {
echo 'That email was already used';
echo '<strong> <button onclick="goBack()">Go back</button></strong><br>';
}
// handle the error of the passwords not matching
if ($password != $password2){
echo 'Passwords did not match. Go back and try again, <a href="https://localhost/mobile_register.php">return</a>';
}else{
$sql="INSERT INTO users (fullname, username, email, password)
VALUES
('".$fullname."','".$username."','".$email."',MD5('".$password."'))";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "You are now registered<br>";
echo "<a href='http://localhost/m/'>Login</a>";
}
mysqli_close($con);
header("Location:http://localhost/m/");
?>
</div>
</div>
<div class="clear"></div>
</body>
</html>