On Wed, 2003-06-04 at 13:15, Daniel J. Rychlik wrote:
> I was looking for a function that will take you to a html page. For instance.
>
> I have a function that checks for !empty values in $_POST; What I would like to do
> is if the field is empty then
>
> go back to the form. I have a function
>
> function display_error ($err) {
>
> echo $err; # I need to redirect or automatically go to the previous page.
>
> }
>
> Is their a PHP function already written that does this ?
One idea:
header("Location: form.html");
With this one, you have to jump through some (admittedly not
difficult) hoops to get your data across the redirect (post it).
Another: Write a function to generate the form for you and call that.
Another: include("form.html"); exit();
With these two, the data is already available within the script, so it
will be easier to show what data was wrong/missing/et cetera. It's
usually easier to have the script which generates the form handle its
input as well, and then pass the resulting data whereever it needs to
go.
> TIA
> Daniel
Just some thoughts,
Torben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php