Tom
Tom

Reputation: 101

ckeditor echo php variables?

Using the wysiwyg CKEditor I stored the following into MySql:

 <p>
Here is the information that we would like to have show</p>
<p>
&nbsp;</p>
<p>
Project:<?php echo $project; ?></p>

I need to echo this content as $content and have the $project variable populate from _POST data.

When I do this however the result looks like this:

Here is the information that we would like to have show

Project: 

In the source for the page you can see the echo statement but nothing appears inspite of knowing that the $project variable is set and has a value.

Someone mentioned a str_replace statement and write the variable as %project% but how does it change from %project% to <?php echo $project; ?>

Thanks for reading.

Tom

Upvotes: 0

Views: 2210

Answers (1)

antpaw
antpaw

Reputation: 16015

to execute php that is saved inside a string you can use eval()

i also like the %project% approach more. i think this is how it would work:

echo str_replace('%project%', $project, $sql_content);

Upvotes: 1

Related Questions