On 7/25/07, Daniel Brown <parasane@xxxxxxxxx> wrote:
On 7/24/07, Daniel Kasak <dkasak@xxxxxxxxxxxxxxxxxxxx> wrote: > On Tue, 2007-07-24 at 08:13 -0400, Daniel Brown wrote: > > > Hello, Dans! > > > > Dan K., is there any reason the validation can't reside within the > > same script as the form, then forward on success? A very simple > > example: > > > > <? > > if($_POST) { > > // Check to ensure that your variables are all correct, > > // then use header("Location: successful-target.php?var1=a&var2=b"); > > // And then, on forwarding, remember to exit; > > } > > ?> > > <FORM METHOD="POST" ACTION="<?=$_SERVER['PHP_SELF'];?>"> > > <INPUT TYPE="TEXT" NAME="var1" VALUE="<?=$_POST['var1'];?>"><BR /> > > <INPUT TYPE="TEXT" NAME="var2" VALUE="<?=$_POST['var2'];?>"><BR /> > > <INPUT TYPE="SUBMIT" VALUE="GO!"> > > </FORM> > > > > Since the user will start with a blank form, and the $_POST values > > won't already be set, the values in the form will be blank on the > > initial page load, but for unsuccessful attempts, they'll be populated > > with the correct data. > > > > ~ Dan^[3] > > > > I've completely changed the way I was doing this now. Initially I > implemented lots of checks for NULL values, as Dan[2] recommended, and > this worked well apart from in the case of text areas. These broke > things completely. I've now decided to shove all form data into session > globals, and just refresh with a 'load_previous' flag in the URL. I my > form constructor sees this flag, it populates things from session > globals. Otherwise it resets the session globals with defaults. > > This seems to be the best solution ( ie the only one that's worked > completely so far ). > > Thank you, both of you. Long live Dans! > > -- > Daniel Kasak > IT Developer > NUS Consulting Group > Level 5, 77 Pacific Highway > North Sydney, NSW, Australia 2060 > T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 > email: dkasak@xxxxxxxxxxxxxxxxxxxx > website: http://www.nusconsulting.com.au > > Viva Danielism! -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107
You Dans driving me insine with all those dans :P Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php