My Humble suggestion is possibly:

upon preview, actually post the edited data to a temp table, and then pull the HTML from the temp table to display the preview page.

Currently you are passing the original content to the preview page.
And You might want to look to see if javascript has any functions for escaping html entities for your GET variable.. To get the edited content you will need to get the contents of the text area in the javascript, not pass the original PHP variable (as this will be the original content)

-Brad

William Stokes wrote:

Hello,

I've used like 3 hours to get this done but I can't figure this out. Hope someone here can help.

I have a form that a user can use to edit www pages. Page content is stored in DB as a HTML code. First user has to select, from <select> menu, which page to edit. Then the selected page content html is retrieved to a <textarea> where it can be edited with tinyMCE editor. Then there's two buttons. Publish to save the edited content back to DB (no problems there) and Preview to open the full page layout in a popup window. The problem is that I can't pass the edited data from the <textarea> to the popup window. Here's last (desperate) attempt:

<table width="800" border="0">
<tr>
<td colspan="2">Edit</td>
</tr>
<tr>
<td colspan="2">
<textarea name="Edited" cols="100" rows="40" id="<? echo $tinymcestatus; ?>" >
<?php
$result=mysql_query("SELECT ContentData FROM x_pages WHERE id = '$ID'");
$ContentData = mysql_fetch_row($result);
print $ContentData[0];
?>
</textarea>
</td>
</tr>
<tr>
<td>
<script language="JavaScript">
function Preview() {
window.open('preview.php?page=<?php echo $ContentData[0] ?>', 'popup', 'width=900, height=900, top=0, left=0, menubar=0, scrollbars=1, location=1, toolbar=0, resizable=1, status=0');
}
</script>
<input type="submit" name="Submit" value="Publish">
<input type="button" onclick="Preview(''); return false;" value="Preview" />
</td>
</tr>
</table>

When I echo $page at the preview.php window it prints some of the data to page and some to address line??? And this is not even the edited data. I should pass The variable $Edited but I can't get it to work

Thanks a LOT
-Will

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to