I\'m trying to display dynamic content in an html page that\'s stored in a database. The pages are created by the customer and they insert a %%ERROR%% marker wherever they want the error message displayed.
Is there a way to turn the result of a function into one big variable so I can just plug it in with a str_replace? Or any other suggestions would be much appreciated.
This is basically what I\'m trying to do:
if ($firstname == \"\" || $lastname == \"\" || $email == \"\") {
function display_error() {
echo \"The following fields are required.<br>\n\";
echo \"Please use your browser\'s back button to return to the order page and fill in the missing information.<p>\n\";
if ($firstname == \"\") echo \"First Name<br>\\n\";
if ($lastname == \"\") echo \"Last Name<br>\\n\";
if ($email == \"\") echo \"Email Address<br>\\n\";
}
$error_page = str_replace(\"%%ERROR%%\", error_message_here, $error_page);
echo $error_page;
} else {
go do something else