I am trying to create a user registration form with PHP, though it is not working. I am getting no error messages and no indication of what is wrong. Can you please help me?
<!doctype html>
<html>
<head>
</head>
<body>
<form method="POST" enctype="multipart/form-data" action="<?PHP echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" accept-charset="UTF-8">
<h4><label>Sign up</label></h4>
<p><label>Username<strong>*</strong><br>
<input type="text" size="48" name="username"></label></p>
<p><label>Password<strong>*</strong><br>
<input type="password" size="48" name="password" ></label></p>
<p><label>Email<br>
<input type="email" size="48" name="email"></label></p>
<p><input type="submit" name="sendfeedback" value="Sign up"></p>
</form>
<?php
$servername = "localhost";
$username = "safsom2";
$password = "somil888";
$dbname = "appDB";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Failed connecting to user database : " . $conn->connect_error);
}
echo 'Success connecting to user database.';
if (isset($_POST['sendfeedback'])) {
$uname = $_POST['username'];
$passwd = $_POST['password'];
$email = $_POST['email'];
if (!$conn->query("INSERT INTO users (username, password, email)
VALUES ('$uname', '$passwd', '$email', '".$_SERVER['REMOTE_ADDR']."')") ) {
echo '<br>Failed account creation';
}
else {
echo '<br>Created account';
}
}
?>
</body>
</html>