> Click Here! "), so in that case I display the form. If it does not have
an
> empty value, the user has clicked the submit button, so I can go ahead
> processing the form data. Like this:
> if ( empty($submit) )
> {
> ### Display the form
> }
> else
> {
> ### Do some checks to make the the data is OK
>
> ### Do the Insert, or whatever else is to be done
> }
I do something similar. However, my layout is like this:
----------
if( isset( $submit )) {
errorChecking();
if( $noErrors ) {
doDBInsert();
header( "location: blah" );
exit();
} // end if( $noErrors )
showErrors();
} // end if( isset( $submit ))
displayForm();
------
This accomplishes a few things:
* The code is easier to follow
* If there is an error in the form, the errors display and the
form re-displays. There is only one section of code that deals
with the form, not two as there would be in an IF/ELSE situation.
But then, this is just me. :)
Chris