Daniel, See below Miles At 06:24 PM 11/25/2001 +0100, Daniel Alsén wrote: > > 2. User fills in a form, clicks "submit" which calls the same script, > > passing itself the values. Depending on the value passed by the submit > > button, the script processes the information (INSERT or UPDATE) and sets > > $done = 1 if successful. > > > > The second scenario is easier to handle. > > Call the same script, passing it $done, and depending on whether or not > > $done is set you redirect. > > > > Juli Meloni has done an excellent tutorial on just this at > > http://www.thickbook.com. look in the tutorials for something like "Form > > With Error Message". You just have to adapt the logic to suit your needs. > >The second scenario is correct. I am actually already using the method in >Melonis tutorial for error messages. But i can´t do a redirection that way >since $done isn´t set until after the db INSERT. My if-statement for the >header is at the top of the page (wich is the only place i can put it) and >will never know if $done is set or not below. > >- Daniel
Before this a whole bunch of processing has been done, either: A username/login has been entered and checked and a checkval generated and stored or A cookie has been read and its value checked in the database If everything is OK, then $REaderOK is set true (1). No output has been sent to the browser Now this is encountered ... if( $ReaderOK == 1 ) { //header("Location: $PHP_SELF?&member_id=$member_id&cLangCode=$cLangCode&ReaderOK=$ReaderOK\n"); header("Location: $origin?&member_id=$member_id&cLangCode=$cLangCode&ReaderOK=$ReaderOK\n"); } else { include("user_logon_title.inc"); echo "<a href = \"$PHP_SELF?cLangCode=$cLangCode\">" . $ErrorAndReturnMsg ."</a> </center>"; } This is just about the end of all the logic stuff, and now the display portion of the page runs. Note that in the else part of the code fragment, that the normal part of the display code is never reached because the page is calling itself with with an error message to the user. If everything is ok, the user is sent back to the page ($origin) which called the logon script. That value was set thusly: <? session_start(); session_register( "origin" ); $origin=$PHP_SELF; . . //after some checking if the user is not logged on the logon script is called here . ?> Miles Thompson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]