This is my code, what am i doing wrong? it gives me the success code but still it does not insert into my database.
<?php include('connect.php') ?>
<html>
<head>
<title>Register</title>
</head>
<body>
<?php
if ( !$_POST['submit']) {
?>
<form action="register.php" method="post">
<table border="1">
<tr>
<td>
Username:
</td>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td>
Password (Confirm):
</td>
<td>
<input type="password" name="passwordconf">
</td>
</tr>
<tr>
<td>
Email:
</td>
<td>
<input type="email" name="email">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Create account" name="submit">
</td>
</table>
</form>
<?php
} else {
$username = $_POST['username'];
$password = $_POST['password'];
$passwordconf = $_POST['passwordconf'];
$email = $_POST['email'];
$errors = array();
if ( !$username ) {
$errors[1] = "You did not enter a username!";
}
if ( !$password ) {
$errors[2] = "You did not enter a password!";
}
if ( !$passwordconf ) {
$errors[3] = "You need to confirm your password!";
}
if ( !$email ) {
$errors[4] = "You did not enter an email address!";
}
if ( $password != $passwordconf ) {
$errors[5] = "Your passwords do not match!";
}
if ( count($errors) > 0 ) {
foreach ( $errors as $error ) {
echo "$error<br>";
}
} else {
echo "Thank you for registering ".$username."!";
mysql_query("INSERT INTO 'user_info'
('username', 'password', 'email', 'admin_level')
VALUES ('".$username."', '".md5($password)."', '".$email."', '1');");
}
}
?>
</body>
</html>