Making the following 2 changes will fix it..
1 - change the text on your submit button, currently you have spaces " Register " , but in your PHP you are not checking for spaces you just have
if (isset($_POST['submit']) && $_POST['submit'] == 'Register')
So change your submit button to...
<input type="submit" value="Register" name="submit" id="submit"/>
then I always find wrapping my if statements in brackets is far better as it none of it will get run unless it passes your checks u are doing, so for example use this..
if (isset($_POST['submit']) && $_POST['submit'] == 'Register') {
$query = 'INSERT INTO nelyn_user
(user_id, username, password, email)
VALUES
(NULL, "' . mysql_real_escape_string($email, $db) . '", ' .
'"' . mysql_real_escape_string($username, $db) . '", ' .
'PASSWORD("' . mysql_real_escape_string($password, $db) . '"))';
$result = mysql_query($query, $db) or die(mysql_error());
$user_id = mysql_insert_id($db);
$_SESSION['logged'] = 1;
$_SESSION['email'] = $email;
header('Refresh: 5; URL=login.php');
}
Hope that helps and all make ssense