I think you need a close } for the first if statement.
Find:
<input type="submit" name="submit" value="SUBMIT" /></p>
</form>
<?php
else {
Change to:
<input type="submit" name="submit" value="SUBMIT" /></p>
</form>
<?php
}
else {
Hope that will fix it. 🙂