John,

header(location:) is the way I'm doing it. I check for the Submit button, if
it was pressed and the processing succeeded, I redirect.  If processing
fails (validation, error in connecting to the database, etc.) I redisplay
the same page with all the same variables that the user just input.  I give
them a message telling them what went wrong and allow them to fix it.

If you find a better way, please share. It would be nice to have something
like <jsp:forward>
=C=


-----Original Message-----
From: John Hicks [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 15, 2003 11:56 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Result in the same page


Cal--

I just posted this reply to your reply on php.general.

--John


From: [EMAIL PROTECTED] (John Hicks)
Newsgroups: php.general
Subject: Re: [PHP] Result in the same page
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
NNTP-Posting-Host: 68.165.13.138
Message-ID: <[EMAIL PROTECTED]>

I, too, like the idea of keeping my processing code in the same file
as the form being processed. But I'm trying to figure out how to
transfer control to the next page based on the result of the forms
processing.

In JSP, i would use <jsp:forward>, which is basically a "Go to"
command. The only reference I can find to "transfer of control" in PHP
is the header(location: ) function. But that requires a complete
server/browser/server interchange.

There must be a more direct way to transfer control in PHP. Would
someone please tell me what it is?

Thanks in advance,

Frappy

[EMAIL PROTECTED] (Cal Evans) wrote in message
news:<[EMAIL PROTECTED]>...
> Yes, just user $_SERVER['PHP_SELF'] as the action of your form. This will
> cause the page to call itself. Then you can branch your processing on the
> existence of a SUBMIT button (or whatever) and handle the query.
>
> I do all my pages this way because it keeps all the code in a single page.
> It's easier for me to find it that way.
>
> =C=
>
> *
> * Cal Evans
> * Stay plugged into your audience.
> * http://www.christianperformer.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to