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

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)?

[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.

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

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.)

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.

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

I really doubt most Preview functions handle that.