Re: Displaying PHP-File
| From: | Brian Clark | Date: | Thu, 10 Aug 2000 09:30:58 +0000 |
| Subject: | Re: Displaying PHP-File | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11101@lists.php.net to get a copy of this message | ||
Martin Thoma wrote:
.. sorry, I think you didn't quite get the point. The page with HTML andUh oh, that again. :)
php-code is called "myform.php4" and works perfectly when calling it directly (for example typing "myform.php4 into the url-field of the browser). Now I want to do the following: Antoher script is called, and when this other script detects an error, "myform.php4" should be read-in as a file, modified (for example displaying "There is an error in field ..." somewhere) and then be printed out.How about something like: <?php if($processed) { /* Verify that all required fields were processed. */ if(!SomeFunctionForCheckingFields($fields)) {
/* if fields are blank */
include 'myform.php4';
}
else
{
/* if they're ok, go somewhere else */
header("Location: http://www.server.com/success.php");
exit; /* probably redundant */
}
}
/* include form if we're still here, or just got here */
include 'form.php'; /* submit button is named 'processed' */
?>
When printing out the page, the HTML-Code is shown, but the form is gone because the php-part is not execute. How can I avoid this ? (if possible without using redirection because I got a lot of redirections in my code and this one redirection would make it much more complicated).Brian