|
Posted by Dan on 10/21/71 11:08
Hello, all -
I am working on a few small projects to try and teach myself how to
build intelligent forms. I have come as far as making a few simple ones
that are created when their parent function is called. Something like
the following:
function displayMyForm($username='',$password='',$account='') {
// do some stuff for the vars that were passed
// create form
}
Nothing much, but it gives me a good footing on the use of displaying
forms dynamically even when some data is missing - making use of default
values.
The problem that I am faced with now, as simple as it seems, is a
situation such as the following:
User goes to index.php, enters in some information. ACTION='<? echo
$_SERVER['PHP_SELF'] ?>' is the action. Some data is carried in the
form of variables that were entered in on a form.
I want that same page to "catch" that data and process it. If the data
is complete and valid, pass to another section of the form. If it is
not, prompt the user to re-enter some data.
I don't really know what I'm asking here. I guess ultimately I'm
curious as to how people make intelligent forms such as this. How do
you deal with missing/incomplete values? What about multiple "steps" of
a form? How do you verify that, if a user is on "step 2", they came
from "step 1"? Do you mix $_GET and $_POST to verify the process?
Not coming from a big programming background, some people might think
that these questions are pretty lame, and I'll go ahead and tell you
that you are absolutely correct. However, as I start, I would like to
develope and work on good programming habits, so I don't learn bad
habits to begin with.
Any feedback will be appreciated.
Thanks
-dant
[Back to original message]
|