Store HTML and dynamic PHP variables in MySQL table

I am currently able to save html in to a MySQL database and call that information when needed and all renders correctly.

However now i want to add dynmaic PHP variables also to the MySQL table along with the html, but when called from the database it displays as html/text and the PHP variables are no longer dynamic. Is this possible?

How can i store html and PHP variables, so they can be returned in the same way.

Please see my example, $ProfileName, $ProfileAge, $ProfileGender are my dynamic variables:

<div class="sampleheader">
    <div class="headerimage"><img src="/images/sample.jpg" /></div>
    <div class="headerprofilename">'.$ProfileName.'</div>
    <div class="headerprofileage">'.$ProfileAge.'</div>
    <div class="headerprofilegender">'.$ProfileGender.'</div>
</div>

Maybe I should return all as html and then use regex or str_replace to find (‘.$ProfileName.’, ‘.$ProfileAge.’, ‘.$ProfileGender.’) and somehome replace for the actual variables.

Any help is much appricated, thanks