sorry if I'm not understanding correctly your problem... but it seems quite 
simple to me...
I've created like 10.000 php forms that does that... I don't see a prob...

what do you want to do?

process a form:
if something's wrong, print error message and go back
if everything is fine go to another page... that's it?

well... database inserts has nothing to do with headers...

you can easily do something like

<?php
switch ($action)
{
         case "process-form":    if( ProcessForm() )
                                         header("Location: next-page.php");
                                 else
                                 {
                                         ShowHeader(); // function to 
display all the HTML you want
                                         printErrMessage();
                                         ShowFooter();
                                 }
                                 break;
         default:                        ShowForm();
                                 break;
}
?>

where ProcessForm returns true or false depending on the DB operation...

of course there cannot be any output before the switch?

did it help?

At 18:24 25/11/01 +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
>
>
>--
>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]


_____________________________
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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]

Reply via email to