For one, it would be really beneficial to paste the exact error message for us, since there is more than one error message PHP can display.
Second, I'm betting it's not an "error" but rather a warning or notice. First, there doesn't appear to be any constant in your script with the name of submit, so I'm guessing by $POST[submit] you really meant $POST['submit']. The latter of the two has a string of "submit" for its array key, while the first suggests that there is a constant defined with the name of submit.
Also, if $_POST['submit'] doesn't exist, you'll get an "undefined index" notice since you're trying to access an item in an array that doesn't exist. As such, you should first check if the variable exists using [man]isset/man or [man]empty/man.
Finally, note that it appears as though your script is vulnerable to SQL injection attacks. User-supplied data should never be placed directly into SQL queries. Instead, it should first be sanitized with a function such as [man]mysql_real_escape_string/man.
Oh, and don't forget to get rid of all of the mysql_error() references when this script goes live (since you should never display MySQL error messages to the user).