lets add an extra: } in the 43.line:
echo "Success!!";
}
} // <---- this was missing
}
else
echo "Your passwords do not match!";
And change this row:
if (password==$repeatpassword)
into:
if ($password==$repeatpassword)
You should learn from a book instead, because this example is not a good technique.
Where did you connect to the database? (mysql_real_escape_string() needed an opened connection. )