Re: Calling HTML pages

From: Date: Wed, 04 Jun 2003 20:31:31 +0000
Subject: Re: Calling HTML pages
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-150262@lists.php.net to get a copy of this message
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

« previous php.general (#150262) next »