is there a sane way to "preview before post"
Posted: Sat Jul 19, 2003 12:16 am
I am working on a site that allows users to post text. So it's a little bit like a forum, except that the text they are posting may be quite long. Say, 20 - 30 standard pages of text, typically, and possibly longer. It is important that the users be able to preview their submission before comitting it to the database. The only way I have been able to implement this, so far, is to echo the text to the preview page, and then hide the same text in a form input field.
Something like this:
<!-- display the preview text to the user -->
<?php echo($text); ?>
<!-- ask if the user wants to comit the text to the db -->
<form ...>
<input type='hidden' value='<?php echo($text); ?>' ... />
<input type="submit' value='Save Text' />
</form>
The obvious problem with this is that it doubles the amount of text being sent to the browser. For a brief forum posting, this is no biggie, but when it is 30 pages, that could seriously bog down users on slow connections.
Is there a better way to do the preview? Is there some way to keep the $text variable alive on the server, so that it isn't necessary to store it in the hidden form field? If there isn't, do people think it would be better or worse to store the text in a temporary table in the database, and then re-insert it into a live table once the user confirms?
If anyone has any pointers to offer, I look forward to reading them.
Something like this:
<!-- display the preview text to the user -->
<?php echo($text); ?>
<!-- ask if the user wants to comit the text to the db -->
<form ...>
<input type='hidden' value='<?php echo($text); ?>' ... />
<input type="submit' value='Save Text' />
</form>
The obvious problem with this is that it doubles the amount of text being sent to the browser. For a brief forum posting, this is no biggie, but when it is 30 pages, that could seriously bog down users on slow connections.
Is there a better way to do the preview? Is there some way to keep the $text variable alive on the server, so that it isn't necessary to store it in the hidden form field? If there isn't, do people think it would be better or worse to store the text in a temporary table in the database, and then re-insert it into a live table once the user confirms?
If anyone has any pointers to offer, I look forward to reading them.