January 18, 2019
  • What we have here, is a failure to communicate…

Capturing Form Submissions – Part 1

Something that as frustrated me for some time is the fact that to capture form posts in PHP, we have to rely on the the POST or GET superglobals and how much a black hole those variables seem to be. Well, black hole isn’t really the best description, as we know where the data is coming from (hopefully) and what it’s going to be (should), but it just seems like I just can’t get a handle on a way that is easy to manage. Really, the longer I develop, the more I hate dislike arrays in general (strange statement for someone that uses a TON of them and HATES the fact that C# can’t do associative arrays.)

However, yesterday I stumbled upon an idea that might make like much easier and, although, it’s not a perfect solution, I think I found a good start:  

So the idea is to create a data object that has all the possible post submission variables and then have a function designed to throw an exception if something is received that is not expected.

Comments List

dustinmoormanJuly 19, 2012 9:25 am /

A good touch on form data input security!