You're missing quotes around your string values:
INSERT INTO Users(Username, Firstname, Surname, Password)
VALUES($email, $fn, $sn, User, SHA1($p))
should be:
INSERT INTO Users(Username, Firstname, Surname, Password)
VALUES('$email', '$fn', '$sn', 'User', 'SHA1($p)')
The reason you get an error is you're not actually checking for any. You need to add an else statement when you check the value of $r
and in there call mysqli_error()
to see your error message.
if ($r) {
echo "success";
}
else {
echo mysqli_error($dbc); exit// this really should be better then this.
}