I have a bunch of html in a header that I want to display if a form has been successfully submitted.
The code is the same on each edit-whatever-file.php and its just a success message which re-directs back to the view-whatever-file.php according to the post data id in the url.
Instead of pasting this html into every edit file, I have created a separate file, but my header code is an echo, goes like this…
// Send form data to mysql
if(isset($_POST['edit_text']))
{
$result = editpage($_POST);
if($result === true)
{ $id = $_POST['id'];
echo 'THE SUCCESS MESSAGE AND REDIRECT HTML CODE HERE';
die();
}
}
Can I do something like:
$success = include(success.php);
Then in the above code echo $success; ??