|
Posted by e_matthes on 11/17/06 20:07
> I appreciate the help. I think the concept is getting clearer. I am
> just curious though. The first time a person loads the webpage wouldn't
> the php execute and since all of the variables are null, wouldn't it
> automatically display an error message even before the person has had a
> chance to fill out the form?
The structure of my pages looks like this:
<?php // Very first thing, so header redirects work
// Initialize variables that appear in html, so they are empty, not
null
if ($_POST) {
// validate & process data
}
?>
<html>
web content
</html>
The if ($_POST) prevents any validation from being done until the user
has submitted some data. It is common for many people not to bother
initializing the variables, but if you look at your html output, it's
pretty ugly with a bunch of "uninitialized variable" messages in the
code. This all works for me locally, but I haven't gone live with it
yet. Am I missing anything?
Navigation:
[Reply to this message]
|