It's not that it's wrong, per sé, just that it could be improved.
It's best to check that a given array index (especially with incoming data) exists first before you use it. For example, code like this:
if($_POST['submit']) {
should be more like this:
if(isset($_POST['submit'])) {
In your case, you could use [man]isset/man or [man]empty/man to check that the given array index exists before you attempt to compare its value to anything.