This sounds like the method I use to submit data back to the server.
How I prefer to do this (for simplicity sake), is to have any forms submit the data back to themselves. Before any page out put is sent to the browser, I have a check looking for $_POST[‘Submit’] (or $_GET[‘Submit’]) being set to the “Value” of the form element. The Value is the text that’s displayed on the button, and in your case “Submit Form”.
If the Variable is set to “Submit Form” that would mean that the form was filled out and the button was clicked. In this case, you’d want to then include the php file that evaluates, parses, checks, stores, processes, emails, or anything else you intended to do with the data.
I can gather up some sample code if my rambling explanation on how I use this is not clear. Let me know.
What do you mean by it “does not work”? As in, the form doesn’t get submitted, or what?
Or of course, the other option is that you missed a reference to it. There could be some kind anti-spam check to ensure the submit button was used by a human user, rather than some robot submitting the form. If there are some included files in your PHP file, did you check in there?
Somewhere near the top of the page there will be a test to see if $_POST[‘Submit’] exists in order to work out whether the form has been submitted and if so to process it. If the form hasn’t been submitted or if there are errors then it eventually gets to the part of the code where it displays the form.