> I included a pseudocode form of my logic here & my actual code below.

A suggestion in similar pseudo code.

"top of page"

"set a flag to display form"

If (form submitted)
{
  "validate entered data"

  if (data is correctly validated)
  {
    "enter data into database"
    
    if (database operation ok)
    {
      "include database ok page"
      "clear a flag to display form"
    } else {
      "include database error page"
      "clear a flag to display form" (or not, depends on how you want to
deal with this)
    }
  } else {
      "display information about data entry problems"
      "set a flag to display form"
  }
}

If (flag to display form is set)
{
  "display form"
}

"end of page"

This is much the same as yours but permits you to handle the whole thing
in one page without having to re-display the form if you don't need to.
I use this basic layout all the time and it has the advantage that you
can keep the form but clear the data if you're expecting someone to
enter more data into the thing.

This method can also let you redisplay the form with data already
provided in cases where the form validation has failed.  You can also
display the relevant validation errors in a way that highlights the
problem within the actual form.

CYA, Dave


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to