When I try to register as a user, why won't my register.php
file do anything? Am I missing something? I already made sure I am connected to the mysql database using the config.db
My registration page:
<html>
<head>
<title> Register!</title>
</head>
<body>
<form action="register.php" method="POST">
<h1>Signup!</h1>
<p>Create an account:</p>
<div>
<label for="name">Name:</label>
<input type="text" id="name" name="firstname" value="" placeholder="First Name" class="login" />
</div> <!-- /field -->
<div>
<label for="email">Email Address:</label>
<input type="text" id="email" name="email" value="" placeholder="Email" class="login"/>
</div> <!-- /field -->
<div>
<label for="pass">Password:</label>
<input type="password" id="password" name="password" value="" placeholder="Password" class="login"/>
</div> <!-- /field -->
<div>
<label for="confirm_password">Confirm Password:</label>
<input type="password" id="confirmpassword" name="confirm_password" value="" placeholder="Confirm Password" class="login"/>
</div> <!-- /field -->
<input type="submit">Register</button>
</form>
</div> <!-- /content -->
</div> <!-- /account-container -->
</body>
</html>
My php file
<?php
include ("configdb.php");
function createUser()
{
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
echo "name";
if($password == $confirmpassword)
{
$query = "INSERT INTO Users (name,email,password) VALUES ('$name','$email','$password')";
$data = mysql_query ($query)or die(mysql_error());
if($data)
{
echo "YOUR REGISTRATION IS COMPLETED...";
}
}
else
{
echo "Passwords do not match";
}
}
if(isset($_POST['submit']))
{
createUser();
}
?>