Forum Moderators: coopster
I need to add a "Preview" button to my property editing page as owners are saving some wonderful blunders. Ideally I would want to force them to preview before saving, the preview should open in the property template, or a copy of it, so they can see how it will look.
My edit_property page pulls data from the mysql db and populates the text areas/fields etc, I have a Save changes button which then takes the content to another page, update.php which writes the submitted data to the db and emails me a note so I can check the blunders.
I can't find any info on previewing, is it easy to do, where do I start?
Is it as simple as posting it to a template which would, if submitted, send it on to update.php, create a page in between?
If you put the data in $_SESSION, be careful or you may get unexpected results if the user previews one post, opens a new window and previews another post, then returns to the first one and clicks on submit.
cameraman's 'pending' field idea is pretty good too, but you'll need to clean the database periodically to get rid of pending posts that were abandonned.
Hope this helps.
I went with cameramans idea, I created a new column "active" Yes/No while they are editing it is set to Yes but as soon as they "preview" (which actually saves all data to the db and sets the active column to No) only after they submit or approve their changes the page issues an UPDATE command to set active to Yes.
Seems to be working