One of the most common tasks that I came across developing interactive
websites was processing users' input. In this article I would like to share the experience
I had developing an object-oriented
solution for it. The best effect that I can imagine this paper
to have is to not just show another solution for checking a submitted
form, but rather to let you taste the power of object-oriented technology.
Together with you, I will look back at the way I thought that brought me to a
solution that was implemented and successfully used. Reading this article requires
some knowledge of object-oriented programming fundamentals. As a
result, we will
have a working example developed.
First of all, we already
know how to examine $HTTP_POST_VARS, we know how to name form inputs in such a
way that they will be presented as a nice PHP array. We've read Richard
Creech's article on making a form's controls dynamic. Why do we need anything else at this stage?
Let me explain. You see,
I have a Delphi background and with Delphi you get very much addicted to re-using
instead of re-inventing. So, if you find yourself coding something that
gives you this dejavu - I've been doing this before - you want to
invent a class that can be reused throughout your projects.