Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • Right, but as I mentioned, I need to handle the case where the data is submitted via POST AND empty, wouldn't these examples also fire off the code Foo when a user simply visits the form page? Commented Sep 14, 2011 at 23:24
  • @Paul: It won't fire unless there is post data. As for empty, I just showed you. You need to validate the form data. Commented Sep 14, 2011 at 23:28
  • I think there is a misunderstanding... please explain how the code in Foo does NOT get executed when a user is simply visiting the page without POSTing data. Commented Sep 14, 2011 at 23:31
  • @Paul: Move it inside the $_POST code block then? I read some other comments and changed my example to what I think you are trying to do. Commented Sep 14, 2011 at 23:40
  • 1
    @Paul: That's right because you forgot the name attribute. Add it and see what happens. Commented Sep 14, 2011 at 23:57