<?php
//-----------Get Current Page Data---------//
$currPage = ("../include/$page" .".php");
$fd = fopen($currPage,"r");
$postedValue = fread($fd, filesize($currPage));
fclose($fd);
echo $postedValue;
//-----------Posted Data-------------------//
if ( isset( $_POST ) )
$postArray = &$_POST ; // 4.1.0 or later, use $_POST
else
$postArray = &$HTTP_POST_VARS ; // prior to 4.1.0, use HTTP_POST_VARS
foreach ( $postArray as $sForm => $value )
{
$postedValue = ( $value ) ;
}
//-----------Write Posted Data-------------//
$fd = fopen($currPage,"w");
fwrite($fd, $postedValue);
fclose($fd);
?>
</head>
<body>
<h4 class="h3">
<font style="text-transform:capitalize;"><?php echo $page; ?></font>
</h4>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your
pages. -->
<form action="<?php $_SERVER[PHP_SELF]?>" method="post">
<p>
<textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10"><?php echo $postedValue; ?></textarea>
</p>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
<div id="footer2">
<hr/>
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/" shape="rect">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright © 2003-2009, <a href="http://cksource.com/" shape="rect">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>
Sun, 01/03/2010 - 01:15
#1

Re: HTML encoding in PHP
viewtopic.php?f=11&t=16315&p=46046#p46046