[RESOLVED] Checking if not postback
Me again.
Follow up to my last resolved thread. This seems to be almost the same question that I escaped with a better tactic thanks to zalez in my last post, but I still don't know how to handle this instance.
Say you have a POST method form that contains a couple of inputs and all must be set and not empty before continuing. If they are not set and empty then you print "Fill in all fields.", for example, to the page.
The default values are empty and not set, so when you navigate to the page for the first time, you print your message immediately.
How in PHP do I tell if the user actually tried to submit the inputs with a button click, in this case, and it is not just the first navigation to the page?
Re: Checking if not postback
if ($_SERVER['REQUEST_METHOD'] == 'POST')
Re: Checking if not postback
penagate's method is how you would tell if the page was posted. As for making sure the fields are filled in, you could use an if statement and look for empty fields. I know this could be cumbersome if you have alot of fields but it is the only way that I have done it with out using third party scripts.
Re: Checking if not postback