The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I am trying to keep all of this in one file, and also add another page with an option on it. However, when I do so, the form fields come up again because it hasn't been submitted. Is there any way to overcome this?

I just have one file, admin.php. I print a header and footer beforehand, and I want to log in. As you see, I have an !$submit command, which I'm sure means that if the form has not been submitted, then do this. Unfortunatly, when I try to link to another part of this document, admin.php?page=test, it adds the form information on top of what I have specified for the admin.php?page=test. That happens, I think, because I have not submitted the form again before I entered the page.

I realize this is not the most effective way to do this, but is there a way around this? I'll try to post a test of this...

Oooooooohhhhh... Yes, now it all makes sense And you're right, it's not the most effective way to do this (for instance, it looks like I could just go to admin.php?page=test without logging in). But, you already knew that. So, enough of the code police, and onto a fix:

I would reorganize your code so that all of the $page arguments are processed first. If no $page variable is present then show the login dialog.