Okay, I read the article, and I think I understand, and I changed the output, or $pcode string, into double quotes, and It made some improvement. The code I input in the form now comes out highlighted, but the html surrounding it gets moved to the end of the highlighted code, and is still plain text. Here is my entire code, top to bottom, minus css and jscript:
<?php
$send = $_POST['send'];
$text = $_POST['text'];
if(!$send){
echo '<form action="" method="post"><textarea name="text"/></textarea><input type="submit" name="send"/></form>';
}
elseif($send){
function makephpcodeBox($pcode, $pID)
{
$pcode = stripslashes($pcode);
$pcode = highlight_string($pcode);
$phpc = "<div style=\"border:1px solid #000000;display:table;width:350;margin:0px auto;\">
<div style=\"background-image:url(bbcode_top.png);background-repeat:repeat-x;\">
<a href=\"javascript:menu('pcode$pID','pexpand$pID','pcollapse$pID');\" title=\"Show Or Hide This PHP Code\">
<span id=\"pexpand$pID\" style=\"display:none;\"><img src=\"expand.gif\" width=\"9\" height=\"9\" alt=\"[+]\" border=\"0\"/></span>
<span id=\"pcollapse$pID\" display=\"inline\"><img src=\"collapse.gif\" width=\"9\" height=\"9\" alt=\"[-]\" border=\"0\"/></span>
</a>
PHP Code :: <a href=\"javascript:code_select('pcode$cID');\" title=\"Highlight The Code\">Select PHP Code</a>
</div>
<div id=\"pcode$cID\">
<div style=\"background-color:#000000;height:1px;width:100%;font-size:0;\"></div>
<div style=\"background-color:#5A2323;height:1px;width:100%;font-size:0;\"></div>
<div style=\"background-color:#470A0A;\">$pcode</div>
</div>
</div>";
return $phpc;
}
$p = 0;
while(preg_match("/\[php\](.*?)\[\/php\]/ise", $text, $matches))
{
$p = $p + 1;
$text = str_replace($matches[0], makephpcodeBox($matches[1], $p), $text);
}
echo $text;
}
?>