I have a PHP script that has this code snippet:
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}
function show_error($myError)
{
header('Location: http://provectium.com/error.html');
exit();
}
And I have a HTML Code (error.html) with a <div> in it to display $myError.
How can I do this?
I was using <?php echo $myError; ?> inside the PHP script, but I want an separate page since it does not function correctly.
EDIT
function show_error($myError)
{
?>
<!DOCTYPE html>
<html lang="en">
...
<?php echo $myError; ?>
...
</html>
<?php
exit();
}
Is this method also OK to use?