Sorry I wasn't more specific, here's a test case that shows this. The test starts from StartPage.php:
CODE
<?php
echo "<HTML><HEAD><TITLE>Test</TITLE></HEAD>\n";
echo "<BODY>\n";
echo "<FORM ACTION=TestRun.php METHOD=\"POST\"\n";
echo "<INPUT TYPE=\"TEXT\" NAME=\"TextTest\">\n";
echo "<INPUT TYPE=\"Submit\" NAME=\"Submit\" VALUE=\"Submit\"\n";
echo "</FORM>\n";
echo "</BODY></HTML>";
?>
and the form goes to TestRun.php:
CODE
<?php
include ( "ErrorTest.php" );
echo "<HTML><HEAD><TITLE>Runner</TITLE></HEAD>\n";
echo "<BODY></P>Running...</P></BODY></HTML>\n";
$length = strlen( $_POST["TextTest"] );
if( $length > 0 ) { echo "OK"; }
else { ErrorTest::makeError( "This is an error." ); }
?>
and if an error happens, the code in ErrorTest.php should run:
CODE
<?php
class ErrorTest {
public static function makeError( $value ) {
echo "<HTML><HEAD><TITLE>Error</TITLE></HEAD>\n";
echo "<BODY><P>ErrorPage</P></BODY></HTML>"
}
}
?>
For some reason, the include statement in RunTest.php doesn't quite seem to work, but the problem still shows up anyway. The html code generated by the method in ErrorTest shows up on the same page as the one generated by RunTest; calling the ErrorTest method doesn't create an entirely new page, as I'd like it to.
So the output of running this, with an error, is:
CODE
<-- One Page-->
<HTML><HEAD><TITLE>Runner</TITLE></HEAD>
<BODY></P>Running...</P></BODY></HTML>
<HTML><HEAD><TITLE>Error</TITLE></HEAD>
<BODY><P>ErrorPage</P></BODY></HTML>
when it should be:
CODE
<--Run Page-->
<HTML><HEAD><TITLE>Runner</TITLE></HEAD>
<BODY></P>Running...</P></BODY></HTML>
<--Error Page (New Page)-->
<HTML><HEAD><TITLE>Error</TITLE></HEAD>
<BODY><P>ErrorPage</P></BODY></HTML>
Is that clearer?
Thanks,
Zel2008
This post has been edited by Zel2008: 5 Nov, 2009 - 06:41 AM