Help - Search - Members - Calendar
Full Version: PHP code in a textarea
Forums > Resource Center > Webmasters' Corner > Resolved Topics
schizo
I'm usually able to figure this kind of thing out on my owning, but my brain is fried and I give up.

I wrote a tutorial on using PHP includes, but I can't seem to get the actual PHP include codes to show up in the textareas.

Here's the page.

Is there anyway to disable the code from actually trying to work, if that makes sense?

help.gif <--Could resist using that cute little nugget.
fixtatik
instead of using the actual php code (<?php include('yaddayadda.php'); ?>), put in the less-than greater-than signs on your own.

two ways to do it:
CODE
&lt;php include('yaddayadda.php'); ?&gt;

or:
CODE
<?php
$s = '<?php include('yaddayadda.php'); ?>';
echo htmlspecialchars($s);
?>

the second one will work better for longer codes. if you have something pretty lengthy, you can save it as an external text file, and set $s to be that file.
schizo
Oh, wow. That was pretty simple. pinch.gif

Thank you so much. happy.gif

Closing and moving to resolved.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.