Forum Moderators: coopster
I'm drawing some pre-HTML formatted content from a DB table.
The result set that resides in a $content VAR looks something like this:
<h1>Crew Member Applicant</h1>
<h2>Personal Information Section</h2>
<p>Blah, blah, blah...</p>
On a few pages of this application, I need to slip a position name just after the Crew Member Application line so it'll look something like this: "Crew Member Application - Captain".
So, I'm trying to use preg_replace - trapping for the closing </h1> tag - like this:
$replace = '</h1>'
$replaceWith = ' - ' . $_SESSION['DesiredPosition'] . '</h1>';
$string = $content;
$content = preg_replace($replace, $replaceWith, $string);
echo $content;
... but, no luck: I keep getting an unexpected T_VARIABLE error.
I suspect it's something to do with the way I'm transferring $content to $string before I do the preg_replace, but I'm not sure.
Could someone please show me the error or my ways?
Great appreciation to all in advance!
Neophyte