# How is the "preview post" done in forum pages?

**URL:** <https://forum.kirupa.com/t/how-is-the-preview-post-done-in-forum-pages/267008>\
**Category:** programming\
**Created:** [July 27, 2008, 10:05am UTC](https://forum.kirupa.com/t/how-is-the-preview-post-done-in-forum-pages/267008 "2008-07-27T10:05:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamhere](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@iamhere](https://forum.kirupa.com/u/iamhere)\
**Post date:** [July 27, 2008, 10:05am UTC](https://forum.kirupa.com/t/how-is-the-preview-post-done-in-forum-pages/267008/1 "2008-07-27T10:05:56Z")

</div>

I’ve often seen sites which, when you post, have a “preview post” button, and then you can click “Submit” or something else - i’m curious how this is done. Where is the data that’s been posted held in between these pages (two separate programs running)?

---

<div class="post-metadata">

**Author:** ![bear](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@bear](https://forum.kirupa.com/u/bear)\
**Post date:** [July 27, 2008, 1:02pm UTC](https://forum.kirupa.com/t/how-is-the-preview-post-done-in-forum-pages/267008/2 "2008-07-27T13:02:13Z")

</div>

[quote=iamhere;2365213]sorry - what does this “sessions” mean? i keep hearing it, but i’m a newbie…

if it’s saved temporarily in the database, is there a command in mysql to actually tell it - get rid of this after 5 minutes, or something?[/quote]

No database when it comes to sessions. It’s a variable saved onto the browser or RAM. Once the browser closes, the session is gone. vbForums probably saves the message as a session as stated by the other member. However, it could just be a post just coming back to itself…which it is.

```auto
<form action="newreply.php?do=postreply&amp;t=304770" name="vbform" method="post" onsubmit="return vB_Editor['vB_Editor_001'].prepare_submit(0, 1)">

```

---

<div class="post-metadata">

**Author:** ![Esherido](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/esherido/32/2158_2.png) [@Esherido](https://forum.kirupa.com/u/Esherido)\
**Post date:** [July 27, 2008, 1:52pm UTC](https://forum.kirupa.com/t/how-is-the-preview-post-done-in-forum-pages/267008/3 "2008-07-27T13:52:33Z")

</div>

There’s 3 main ways to do this:

1. Store the post in the database.
2. Store the post in a cookie. (Which is held on the user’s computer.)
3. Store the post in a session. (Which is held on the server.)

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 27, 2008, 2:31pm UTC](https://forum.kirupa.com/t/how-is-the-preview-post-done-in-forum-pages/267008/4 "2008-07-27T14:31:33Z")

</div>

Or … the user previews the post, which returns a page with the previewed content (just the content with the BBCode formatters run over it) and a input field with the value passed from the previous form: `$_POST['message']`. When they submit again, they’re submitting the message field on that page.

---

<div class="post-metadata">

**Author:** ![Esherido](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/esherido/32/2158_2.png) [@Esherido](https://forum.kirupa.com/u/Esherido)\
**Post date:** [July 27, 2008, 2:43pm UTC](https://forum.kirupa.com/t/how-is-the-preview-post-done-in-forum-pages/267008/5 "2008-07-27T14:43:53Z")

</div>

^ That would be simplest, but there could be complications if the user clicked the Back button.

---

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [July 27, 2008, 2:45pm UTC](https://forum.kirupa.com/t/how-is-the-preview-post-done-in-forum-pages/267008/6 "2008-07-27T14:45:23Z")

</div>

I really doubt most _Preview_ functions handle that.
