RE: [PHP-DB] Hold that insert!

From: Date: Tue, 27 Mar 2001 16:46:08 +0000
Subject: RE: [PHP-DB] Hold that insert!
Groups: php.db 
Request: Send a blank email to php-db+get-7884@lists.php.net to get a copy of this message
> 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

« previous php.db (#7884) next »